Message-driven beans (MDBs) make consuming JMS messages a lot easier. With just a couple of annotations and implementing the onMessage method, you can make any Java object a consumer of JMS messages. In this section, we will implement an MDB to consume messages from the Course queue. To implement MDBs, we need to create an EJB project. Select File | New | EJB Project from the main menu:
Figure 10.9: Create a EJB project to implement MDBs
Enter Project name as CourseManagementEJB. Click Next. Accept the default values on the subsequent pages and click Finish on the last page.
Right-click on the project and select the New | Message-Driven Bean option. This opens the MDB creation wizard:
Figure 10.10: MDB creation wizard – class file information
Enter packt.jee.eclipse.jms.mdb as Java package and CourseMDB as Class...