Lesson 30Introducing JMS and MOM

People send messages to each other via e-mail, instant messages, Twitter, Facebook, and so on. People can also communicate using more traditional methods by sending regular mail. You just need to drop a letter in a mailbox, and the rest is taken care of by postal service providers and logistics companies such as USPS, FedEx, UPS, and DHL.

Applications can send messages to each other using specialized servers known as message-oriented middleware (MOM), which plays a role similar to that of the delivery services. A program “drops the message” into a message queue (think mailbox) using the Java Messaging Service (JMS) application programming interface (API), and the message is delivered to another application that reads messages off of this queue. In short,  JMS is an API for working with MOM servers. 

Although JMS is a part of the Java EE specification, you can use it with Java SE applications without needing to have any Java application server—just make a .jar file containing JMS classes available to your program. This lesson shows you how to write both standalone Java clients and those that live inside a Java EE server. These clients send and receive applications with the JMS API via a MOM provider. In Lesson 31 you learn about the value that message-driven beans bring to the table.

Messaging Concepts and Terminology

You have already learned several methods of data exchange in distributed Java applications: direct socket communication, RMI, ...

Get Java Programming 24-Hour Trainer, 2nd Edition 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.