Chapter 7. Java Message Service (JMS) and Message-Driven Beans

If you’ve worked through all the previous chapters, you have a fully functional vertical slice of the JAW Motors application that allows you to view, add, edit (update), delete, and buy cars. JAW Motors now wants to run a credit check on potential customers to pre-qualify them for car loans as part of the auto buying process. Like many other businesses, JAW Motors doesn’t do its own credit verification and uses an external online service to run a credit check. Once we add a form to the JAW Motors web site to verify someone’s credit, what happens when they enter their credit information and press the submit button? Should we make them wait until the external service finishes? This process could take several minutes, hours, or even days. Making the user wait around for the final result is unacceptable. After pressing the submit button, the user should be free to go back to what they were doing—viewing, adding, editing, and deleting cars. We need a way to defer the credit verification process to the background so the user can continue using the web site.

J2EE provides the following mechanisms for deferring work to the background:

  • JMS (Java Message Service)

  • Message-Driven Beans (MDBs)

The JMS API provides a vendor-neutral standard programming interface for creating, sending, and receiving messages. JMS enables Java applications to asynchronously exchange messages containing data and events. JMS 1.1 is part of the J2EE ...

Get JBoss at Work: A Practical Guide 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.