JMS API Programming Model

JMS API Programming Model

JMS (Java Message Service) is a Java API that allows applications to create, send, receive, and read messages. The JMS API enables communication that is not only loosely coupled but also:

  • Asynchronous. A JMS provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them.
  • Reliable. The JMS API can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.

In this article, we will use ActiveMQ as JMS provider. ActiveMQ is an open sourced implementation of JMS API 1.1 as part of the J2EE 1.4 specification. You can download ActiveMQ from this link. After the download, extract it to any directory and run the ‘activemq’ (for Linux) or ‘activemq.bat’ (for Windows) from beneath the ‘{path-where-you-extracted-activemq}/bin’ directory.

ActiveMQ up and running

ActiveMQ up and running

Image above (I’m using Windows 8) show that ActiveMQ is up and running. You can close it any time by pressing Ctrl-C. ActiveMQ has a nice admin console, where you can see a lot of useful informations and change the settings: http://localhost:8161/admin/. (user/pass: admin/admin). Continue reading