Send Messages to JMS from a Production
InterSystems IRIS becomes a JMS producer when an interoperability production includes a business operation which uses the JMS outbound adapter implemented using the PEX framework (EnsLib.JMSPEX). This adapter allows the business operation to send messages to a JMS queue or topic. You have two options when using a production as a JMS producer: use a built-in business operation that leverages the outbound adapter or build your own business operation that uses the adapter.
This page describes how to use the outbound adapter and business operation for JMS which InterSystems implements using the PEX framework. The associated classes are part of the EnsLib.JMSPEX package. Do not use classes from the legacy EnsLib.JMS package, which may be removed in future releases.
The JMS outbound adapter is the class EnsLib.JMSPEX.OutboundAdapterOpens in a new tab. It includes the following settings, all of which appear in the Management Portal as settings for the business operation that uses the adapter:
URL defines the URL for the JMS server.
InitialContextFactoryName defines the name of the initial JMS context factory.
ConnectionFactoryName defines the name of the JMS connection factory.
ClientID defines a string to identify the production as a JMS client.
Credentials defines the InterSystems credentials that correspond to the username and password of a JMS client. For details on creating credentials, see Defining Reusable Items for Use in Settings.
For general information about building a custom business operation that uses an outbound adapter, see Defining Business Operations.
Send JMS Messages
The class of the messages sent by the outbound adapter to JMS is EnsLib.JMSPEX.MessageOpens in a new tab. This class contains the following properties for defining the message:
destination defines the JMS queue or topic where the producer is sending messages.
type defines the message type ("Text" or "Bytes").
textBody or bytesBody defines the content of the message body. Of the two, set the property corresponding to the message type.
You can also use the properties property to attach metadata to your message. The properties property accepts a %ListOfObjects collection of %External.Messaging.JMSMessageProperty objects. See the documentation about the JMS API for further guidance on creating JMS message property objects. For general information about JMS message properties, refer to the JMS documentationOpens in a new tab.
The outbound adapter's SendMessage() method takes a EnsLib.JMSPEX.MessageOpens in a new tab object as its sole argument, and sends that message to the JMS server. For example, a custom business operation could call the adapter’s method by including the following:
Built-in Business Operation
Rather than building a custom business operation that uses the outbound adapter, you can simply add EnsLib.JMSPEX.OperationOpens in a new tab to the production and define the necessary settings using the Management Portal. This business operation calls the adapter's SendMessage() method when it receives a request from another business host in the production. This request should contain a JMS message of type EnsLib.JMSPEX.MessageOpens in a new tab.
For basic information about adding a business operation to a production, see Adding Business Hosts.