Consuming JMS messages using MDBs

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 ...

Get Java EE 8 Development with Eclipse now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.