10.26.0

IMessageDispatcher Interface

In the typical scenarios, using Subscribe(ISubscription, Boolean) , CreateFlow(FlowProperties, IEndpoint, ISubscription, EventHandlerMessageEventArgs, EventHandlerFlowEventArgs) or CreateFlow(FlowProperties, IEndpoint, ISubscription, EventHandlerMessageEventArgs, EventHandlerFlowEventArgs, EndpointProperties) client applications can register interest to receive messages with destinations matching the set of added subscription(s). All matching messages are received within the context of the message callback delegate. There's one delegate registered per session or flow.

IMessageDispatcher is an interface abstraction which enables the API to further demultiplex messages to consumers based on registered subscriptions (within aISession or IFlow). Dispatching/demultiplexing incoming messages based on topics allows different callback delegates to be invoked based on the received message's topic. Full wildcard subscription syntax is supported see ITopic for more details.

To better illustrate the usage of this feature, consider the following examples: A client application registers interest to receive messages matching 'car/>', it does so by calling the Subscribe method on an ISession instance. All messages matching this wildcard topic are received over the message callback delegate. In this case, the client receives any message matching 'car/>', for example: 'car/gmc' or 'car/toyota' Using the Topic dispatch feature, the client application (as described above) can demultiplex incoming messages to different callback delegates. For example, it can create a couple of IDispatchTarget instances; the first one with 'car/gmc' as topic subscription and the second with 'car/toyota'. Then it can call the ISession's Subscribe(IDispatchTarget...) method to add these subscriptions along with the delegates to invoke when receiving matching messages on 'car/gmc' or 'car/toyota'. Delivered message with destinations outside of these two topic subscriptions, are still received over the default message callback delegate associated with the ISession instance.

Note: In order to use this feature, the parent ISession's SessionProperties must have TopicDispatch set to true.

Definition

Namespace: SolaceSystems.Solclient.Messaging
Assembly: SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.26.0
C#
public interface IMessageDispatcher

Methods

CreateDispatchTarget Creates a IDispatchTarget instance to be used in the Subscribe(IDispatchTarget, Int32, Object) and Unsubscribe(IDispatchTarget, Int32, Object) methods.

Note: Client applications must keep IDispatchTarget object references accessible if they want to Unsubscribe from the given IMessageDispatcher, and remove already added Topic subscriptions. IDispatchTarget internal object ID constitutes a unique key. Forgetting to keep a reference to IDispatchTarget objects make subsequent Unsubscribe(IDispatchTarget, Int32, Object) calls impossible.

Subscribe Adds a IDispatchTarget subscription to the given IMessageDispatcher.

Note: In order to use this feature, the parent ISession's SessionProperties must have TopicDispatch set to true.

Unsubscribe Removes an IDispatchTarget subscription from the given IMessageDispatcher.

Note: To use this feature, the parent ISession's SessionProperties must have TopicDispatch set to true.

See Also