November 2003
Intermediate to advanced
1488 pages
36h 35m
English
Let's do an end-to-end implementation and testing of a Message-Driven bean that will simply print out the information about the received messages. The same class will be deployed as two beans: one will listen on a queue and the other will subscribe to a topic. We'll go through the whole process of creating and deploying the beans, issuing test messages, and monitoring how they behave.
The bean class is straightforward, as shown in Listing 23.1.
import java.util.*; import javax.ejb.*; import javax.jms.*; import javax.naming.*; public class SnoopMDB implements MessageDrivenBean, MessageListener { private MessageDrivenContext context = null; private Context jndiContext = null; public void ejbCreate ... |
Read now
Unlock full access