Inter-transport Communication¶
Inter-transport communication becomes necessary, when participants want to communicate that are connected to the unified bus using different transport mechanisms.
Inter-Transport Setup¶
This page describes how to setup participants for inter-transport communication using the following scenario which is illustrated in the above figure:
Participants reside in two separate processes
- One process is an instance of the program
inprocess-and-socket (source:
inprocess-and-socket.cpp
) - The other process is an instance of the program
socket-only (source:
socket-only.cpp
)
Note
With this setup, the listener in the inprocess-and-socket process will currently receive all events twice.
There are two ways to attach multiple transports to participants:
- Via configuration options (configuration file, environment variables, etc.)
- Programmatically
These two alternatives are described below.
Via Configuration Options¶
When configured via the configuration mechanism, the multi-transport setup will have a global effect in the following sense: it will affect all participants in all processes which are not explicitly instantiated with a different set of connectors.
In addition to the Spread transport which is (currently) enabled by default, other transports can be enabled globally using a configuration file fragment like this:
[transport.inprocess]
enabled = 1
Programmatically (C++)¶
The set of transports used by individual
participants or as a default by all newly created
participants can be configured by modifying
rsb::ParticipantConfig::Transport
objects.
These objects contain, among other things, an option which
controls whether a particular transport is enabled. A modified
rsb::ParticipantConfig
object can be used in two ways:
Globally for a Process
The example programsinprocess-and-socket.cpp
andsocket-only.cpp
implement the inter-transport setup described above by modifying the default participant configuration in the inprocess-and-socket process to include the inprocess transport.
Locally for a Participant
In order to use a prepared
rsb::ParticipantConfig
object only locally instead of installing it as a global default, it can be passed to the following methods:
rsb::Factory::createReader
rsb::Factory::createListener
rsb::Factory::createInformer
Note
In each of these cases, the modified configuration options will only effect the participant created by the method call.