Java Reference
In-Depth Information
Consuming ActiveMQ messages
Well done! The hardest part is done. Now in order to consume JMS messages sent
by ActiveMQ broker, we will add a @ResourceAdapter annotation into a message-
driven bean. This MDB will intercept bookings from the web application running on
the Apache Geronimo application server:
@MessageDriven(name = "ActiveMqBridgeService",
activationConfig = {
@ActivationConfigProperty(propertyName =
"destinationType", propertyValue =
"javax.jms.Queue"),
@ActivationConfigProperty(propertyName =
"destination", propertyValue = " java:jboss/
activemq/queue/TicketQueue"),
@ActivationConfigProperty(propertyName =
"acknowledgeMode", propertyValue =
"Auto-acknowledge") })
@ResourceAdapter(value="activemq-rar-5.7.0.rar")
public class ActiveMqBridgeService implements
MessageListener {
@Inject private Logger logger;
@Inject private BookerService bookerService;
public void onMessage(Message message) {
Long seatId = null;
int price=0;
TextMessage tm = (TextMessage) message;
logger.info("Received message from
ActiveMQ"+tm.getText());
Search WWH ::




Custom Search