Universal Messaging 10.11 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for Java | Provider for JMS | JMS Message / Event Mapping
 
JMS Message / Event Mapping
Universal Messaging provides interoperability between JMS and Non-JMS client APIs. The API for the Universal Messaging Provider for JMS shares the same event structures sent over the wire as other Universal Messaging Client APIs. The nConsumeEvent in the Universal Messaging client APIs is the basic structure of all events published and subscribed whether JMS or Non-JMS, Java or C#.
The JMS Message has a distinct structure: the header, the message properties and the body. In the Universal Messaging client API, the nConsumeEvent is the container for the JMS message structure. Any JMS message consumer on a topic or queue expects the nConsumeEvent to be in a predefined format with specific JMS header values, message properties and a message body. The JMS Header values are stored in the nEventAttributes of the nConsumeEvent and any message properties are stored in the nEventProperties objects for the same event. The message body is different for each of the JMS message types (bytes, map, stream, object, text) but it is always stored in the byte[] payload of the nConsumeEvent.
Usability
Publishing a JMS Message using the API for the Universal Messaging Provider for JMS sends an nConsumeEvent to the server with the message body stored in the event payload, i.e. the event byte[]. Each JMS Header exists in the nEventAttributes, and any JMS message properties are stored in the nEventProperties. The Java, C++ and C# Client APIs use the same structure for nConsumeEvent and can therefore all consume JMS Message objects. As there is no equivalent JMS C# or C++ specification, these APIs will treat these messages as normal nConsumeEvent objects.
JMS provides a Map Message type, within Universal Messaging the map object is represented by an nEventProperties. When the message is published this map is serialised and stored in the event payload. In order to consume this message from C# you can convert the payload back to an nEventProperties using the getPayloadAsDictionary() method.
Publishing a non-JMS Message for consumption by JMS-based API clients also provides a level of interoperability. The API for JMS will interpret any nConsumeEvent objects published by any other non-JMS client API (Java, C#, Javascript, Mobile etc.) as BytesMessage objects and deliver them to the JMS consumers as such.