Message-driven beans
The purpose of a message-driven bean is to consume messages from a Jakarta messaging queue or a Jakarta messaging topic, depending on the messaging domain used (refer to Chapter 13). A message-driven bean must be annotated with the @MessageDriven
annotation. The mappedName
attribute of this annotation must contain the Java Naming and Directory Interface (JNDI) name of the message queue or message topic that the bean will be consuming messages from. The following example illustrates a simple message-driven bean:
package com.ensode.jakartaeebook; //imports omitted for brevity @JMSDestinationDefinition( name = "java:global/queue/JakartaEEBookQueue", interfaceName = "jakarta.jms.Queue", destinationName = "JakartaEEBookQueue" ) @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationLookup», ...