6.4. Writing Point-to-Point Applications in Java JMS
This section describes three programs that implement Point-to-Point messaging in Java JMS:
Producer.java publishes messages to the queue named message_queue.
Consumer.java uses a message consumer to receive messages from the queue named message_queue.
Listener.java uses a message listener to receive messages from the queue named message_queue.
Unlike the C++ and Python examples, our Java JMS examples use JNDI to establish the server environment instead of using a separate configuration program. The publisher and listener each look for a queue with the correct name. The JMS library transparently creates destinations on the broker when required.