Working with message queues
As we mentioned earlier, message queues are used when our Jakarta Messaging code uses the PTP messaging domain. For the PTP messaging domain, there is usually one message producer and one message consumer. The message producer and the message consumer don’t need to be running concurrently in order to communicate. The messages placed in the message queue by the message producer will stay in the message queue until the message consumer executes and requests the messages from the queue.
Sending messages to a message queue
The following example illustrates how to add messages to a message queue:
package com.ensode.jakartaeebook.ptpproducer; //imports omitted for brevity @JMSDestinationDefinition( name = "java:global/queue/JakartaEEBookQueue", interfaceName = "jakarta.jms.Queue" ) @Named @RequestScoped public class MessageSender { @Resource private ConnectionFactory...