Introducing 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 such as the post. You just need to drop a letter in a mailbox, and the rest will be 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 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) API, and the message is delivered to another application that reads messages off of this queue.
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 containing JMS classes available to your program. In this lesson you’ll learn how to write simple Java clients to send and receive applications with the JMS API via a MOM provider. In Lesson 31 I’ll show you how to bring a Java EE application server to the messaging architecture, and why it’s beneficial. Finally, in Lesson 32 you’ll 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, and HTTP-based interactions. But all of them were ...