Building a JMS Client
Added 31 Jul 2008
A typical JMS client can be built following these basic steps:
- Create a connection to the messaging system provider
- Create sessions, for sending and receiving messages
- Create
MessageProducersandMessageConsumersto create or receive messages
Once these steps have been performed, a message-producing client will create messages and publish them to topics, while a message-consuming client will listen for messages associated with a topic, and consume them as they arrive.
To illustrate in detail how this works, we examine a typical message producer, used to publish messages to a topic in a pub/sub messaging system. Note that all exception handing code has been omitted for clarity.