Just a second...

Transforming JMS messages into Diffusion Cloud messages or updates

JMS messages are more complex than Diffusion™ Cloud content. A transformation is required between the two formats.

The following modes of transformation are provided:
Basic
Only the textual content of a message is relayed.
JSON
All JMS headers and properties are relayed, in addition to the textual content of the message. These values are expressed as JSON in the corresponding Diffusion Cloud message.
You can configure which one of these transformation modes your JMS adapter uses at the per topic level.

JMS message structure

JMS messages comprise headers, properties, and a payload. Currently, only JMS TextMessages are supported by the JMS adapter.

Figure 1. JMS message structure A JMS message has headers, properties, and a payload.
Headers
This is a fixed set of properties whose names all begin with 'JMS'. Some, such as JMSDestination, are mandatory. Others are optional. For more information, see https://docs.oracle.com/javaee/7/api/javax/jms/Message.html.
Properties
A set of name-value pairs.
Payload
The contents of the message. This is a String.

Basic transformation

In a basic transformation only the textual payload or content of the message is relayed in either direction.

Figure 2. Basic mapping from a JMS message to a Diffusion message The headers and properties of the JMS message are ignored and only the payload is relayed as a Diffusion message.

When relaying a JMS message to Diffusion Cloud , the JMS adapter creates a Diffusion Cloud message whose content is the JMS message payload. The headers and properties of the JMS message are ignored.

Figure 3. Basic mapping from a Diffusion message to a JMS message The Diffusion message content is set as the JMS message payload. No properties or headers are set by the JMS adapter, but some headers are set by the JMS provider.

When relaying a Diffusion Cloud message to JMS, the JMS adapter sets the JMS message payload to be the Diffusion Cloud content. The JMS adapter does not set any properties or headers on the JMS message. The JMS provider sets any mandatory headers that are required on the JMS message.

JSON transformation

In a JSON transformation all information is relayed both directions. The JMS message information is expressed in JSON format inside the Diffusion Cloud message content.

Figure 4. Mapping from a JMS message to and from JSON in a Diffusion message JMS message headers are mapped into a "headers" JSON member, that contains the headers as name-value pairs. JMS message properties are mapped into a "properties" JSON member, that contains the properties as name-value pairs. JMS message payload is mapped into the value of a JSON pair whose name is "text".
When relaying a JMS message to Diffusion Cloud , the JMS adapter performs the following actions:
  • Expresses the Diffusion Cloud content as a single JSON object.
  • Maps the JMS message headers to a JSON object called "headers" inside of the Diffusion Cloud message content. The "headers" object contains all of the JMS message headers as name-value pairs. For example,
      "headers": {
        "JMSType": "abc",
        "JMSPriority": 9
      }
  • Maps the JMS message properties to a JSON object called "properties" inside of the Diffusion Cloud message content. The "properties" object contains all of the JMS message properties as name-value pairs. For example,
      "properties": {
        "AString": "def",
        "ABoolean": true
      }
  • Maps the textual payload of the JMS message to a JSON item called "text" inside of the Diffusion Cloud message content. For example,
      "text": "Message content"

When relaying a Diffusion Cloud message to JMS, the JMS adapter parses the JSON content of the Diffusion Cloud message and uses the information to set the headers, properties, and payload of the JMS message accordingly.