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.
JMS message structure
JMS messages comprise headers, properties, and a payload. Currently, only JMS TextMessages are supported by the JMS adapter.
- 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.
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.
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.
- 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.