Coding Messaging Objects
A JMS client typically creates a connection, one or more sessions, and several message producers and consumers. This section shows how to write code for these objects:
A
connection object encapsulates an open connection with a JMS provider. When a connection is created, it is in stopped mode, meaning that no messages can be received.
The JMS client in this example consists of two applications (a message sender and message receiver) that must each connect to the webMethods Broker used as a JMS provider; therefore, two connections are required.
A
session object is a single-threaded context for producing and consuming messages, and is used to create the necessary message producer and message consumer objects. A session also provides the context for grouping a set of send and receive messages into a transactional unit.
A
message producer object, created by a session object, is used to send messages to a destination (a topic or a queue).
A
message consumer object, created by a session object, is used for receiving messages sent to a destination.