Working with message topics
Message topics are used when our Jakarta Messaging code uses the pub/sub messaging domain. When using this messaging domain, the same message can be sent to all subscribers to the topic.
Sending messages to a message topic
The following example illustrates how to send messages to a message topic:
package com.ensode.jakartaeebook.pubsubproducer; //imports omitted @JMSDestinationDefinition( name = "java:global/topic/JakartaEEBookTopic", interfaceName = "jakarta.jms.Topic" ) @Named @RequestScoped public class MessageSender { @Resource private ConnectionFactory connectionFactory; @Resource(mappedName = "java:global/topic/JakartaEEBookTopic") private Topic topic; public void produceMessages() { JMSContext jmsContext = connectionFactory...