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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.