Creating Custom JMS Services and Operations Using the Adapter
This article discusses a legacy implementation of JMS messaging that should not be used for new implementations. This legacy implementation may be removed in future releases. Instead see Common Messaging APIs.
Creating custom JMS business services and business operations requires writing custom ObjectScript code and consequently takes more development resources than using the built-in JMS services and operations, but provides better performance as you can access the Java Gateway proxy object directly.
To develop a custom JMS business service:
Implement a custom BusinessService class using EnsLib.JMS.InboundAdapter as its adapter.
Override the OnProcessInput() method with the following signature:
Method OnProcessInput(pMessage As %Net.Remote.Object, Output pOutput As %RegisteredObject) As %Status
pMessage is a Gateway proxy object of a Java message object of class com.intersystems.enslib.jms.Message. Properties and methods of the Java message object can be accessed using the Gateway proxy interface. The pMessage object contains the message received from the JMS provider.
To develop a custom JMS business operation:
Implement a custom BusinessOperation class using EnsLib.JMS.OutboundAdapter as its adapter.
Override the OnMessage() method or implement a message map. See Defining a Message Map in Developing Productions for information on message maps.
Call ..Adapter.GetNewMessage(tMessage) to get the message that was sent to the business operation by another host in the production.
tMessage has the class %Net.Remote.Object.
tMessage is a Gateway proxy object of a Java message object of class com.intersystems.enslib.jms.Message. Properties and methods of the Java message object can be accessed using the Gateway proxy interface. Access tMessage with properties and methods that are implemented in Java class com.intersystems.enslib.jms.Message.
Send the message to the JMS provider by calling ..Adapter.SendMessage(tMessage).
Once you have developed your custom JMS business service and JMS business operation, you add them to a production just like you would the built-in JMS business hosts.