Example: Configuring messaging with the JMS adapter
Use the publications element of the JMSAdapter.xml configuration file to define how Diffusion™ clients send messages to JMS destinations. Use the subscriptions element of the JMSAdapter.xml configuration file to define how Diffusion clients receive messages from JMS destinations.
Note: As of Diffusion 6.5, the JMS adapter uses
Diffusion request-response messaging, not the deprecated one-way messaging system
which has been removed.
From Diffusion clients to JMS destinations
The following example defines the Diffusion path
through which the JMS adapter receives messages from a Diffusion client and the JMS destination to send those
messages to.
<publications> <publication> <destination>jms:queue:EXAMPLE.REQUEST.QUEUE</destination> <messaging topicName="example/topic/requests" routingProperty="JMSCorrelationID"> <transformation type="basic"> <sessionProperties> <sessionProperty from="$Principal" to="diffusionPrincipal"/> </sessionProperties> </transformation> </messaging> </publication> </publications>
- The routingProperty attribute describes the JMS header or property that the JMS adapter uses to set or get the client session ID.
- The transformation section defines how a message is transformed between a JMS message and a Diffusion message. For more information, see Transforming JMS messages into Diffusion messages or updates.
- The sessionProperties section defines whether the Diffusion session properties of the client that sends the message are included as JMS headers or properties in the transformed message. Currently, only $Principal is supported.
From JMS destinations to Diffusion clients
The following example defines the JMS destination that the JMS adapter retrieves
messages on and the Diffusion path through which the
JMS adapter relays those messages to a Diffusion client.
<subscriptions> <subscription> <destination>jms:queue:EXAMPLE.UPDATE.QUEUE</destination> <options noLocal="true"/> <messaging topicName="example/direct/messages" routingProperty="JMSCorrelationID"/> </subscription> </subscriptions>
- The routingProperty attribute describes the JMS header or property that the JMS adapter uses to set or get the client session ID.
- The noLocal attribute of the options element defines whether the JMS adapter does not retrieve messages from a JMS queue that it is the originator of.