Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

Sending Message Confirmation to a Client


We have already seen how an EJB container acknowledges message receipt with the JMS server. In this section we look at how a message producer client can be informed that its message has been received by an MDB.

This is done by the client setting the JMSReplyTo attribute with the message. JMSReplyTo contains the destination, queue or topic, to which the MDB should send its confirmation message. The MDB uses the ObjectMessage.getJMSReplyTo() method to obtain the confirmation destination. The MDB then acts as a message producer to send a message to the confirmation destination.

We will look at the example we have used throughout this chapter. Instead of using a session bean to send a JMS message to an MDB, we will use a Java application program. Recall that a session bean cannot act as a JMS message consumer. The Java application program, TopicProducer, will act both as a topic producer and a synchronous queue consumer. The code for TopicProducer is...