Loopback Binding
Configuration reference for the Loopback message bus binding.
Overview
The Loopback binding enables message exchange between applications running in the same process. This binding is primarily used for unit testing where several applications may be launched in the same process for easy debugging.
When you configure a bus binding to use a loopback bus, a LoopbackBus instance is statically created on demand using the address provided by the binding. Two applications that connect to a loopback bus with the same name can exchange messages with one another.
For conceptual information about the Loopback binding, see Loopback Binding.
The Loopback binding only works within the same process. It cannot be used for inter-process communication.
Bus Descriptor Format
Loopback buses can be configured using a descriptor string or decomposed DDL format.
Descriptor String
loopback://<busname>&prop1=val1&propN=valNExample:
loopback://my-bus&topic_starts_with_channel=false&set_bus_and_channel_on_receipt=trueDecomposed DDL Format
<buses>
<bus name="my-bus">
<provider>loopback</provider>
<address>my-bus</address>
<properties>
<topic_starts_with_channel>false</topic_starts_with_channel>
<set_bus_and_channel_on_receipt>true</set_bus_and_channel_on_receipt>
</properties>
<channels>
<!-- channel configuration -->
</channels>
</bus>
</buses>As Descriptor (Substitution Support)
The descriptor form is useful when the descriptor name may be supplied as an external configuration property that is substituted at runtime, but defaults to loopback for testing:
This example defaults to loopback but can be overridden at runtime with a different bus descriptor (e.g., Solace) via the myBusDescriptor property.
Binding Specific Properties
The Loopback binding does not have any binding-specific properties beyond the general bus properties (such as topic_starts_with_channel, set_bus_and_channel_on_receipt, etc.) that apply to all message bus bindings.
Loopback Bus Naming
When working with loopback buses, it is sometimes useful to be able to look up a loopback bus by name. Loopback buses are named using their address (and optionally their port).
If you have configured a loopback bus via loopback://my-bus, you can look up the bus as follows:
See Also
Loopback Binding - Conceptual overview
Configuring Bus Connections - General bus configuration
Last updated

