Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Java Message Service (JMS) for?

Tags:

java

jms

I am currently evaluating JMS and I don't get what I could use it for.

Currently, I believe this would be a Usecase: I want to create a SalesInvoice PDF and print it when an SalesOrder leaves the Warehouse, so during the Delivery transaction I could send a transactional print request which just begins when the SalesOrder transaction completes successfully.

Now I found out most JMS products are standalone server.

  • Why would a need a Standalone Server for Message Processing, vs. e.g. some simple inproc processing with Quartz scheduler?
  • How does it interact with my application?
  • Isn't it much too slow?
  • What are Usecases you already implemented successfully?
like image 426
Daniel Avatar asked Jun 10 '10 14:06

Daniel


People also ask

Where is JMS used?

JMS was designed to simplify the process of developing business applications “that asynchronously send and receive business data and events. “ It is supported by a wide range of enterprise messaging products and supports both point-to-point queuing and publish-subscribe messaging models.

What is JMS in messaging?

The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java Platform Enterprise Edition (Java EE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.

What services are provided by JMS?

Java Message Service (JMS) is an implementation of such a messaging system. It provides an API for creating, sending, receiving, and reading messages. Java-based applications can use it to connect to other messaging system implementations.

What are the advantages of JMS?

Advantage of JMS 1) Asynchronous: To receive the message, client is not required to send request. Message will arrive automatically to the client. 2) Reliable: It provides assurance that message is delivered.


2 Answers

JMS is an amazingly useful system, but not for every purpose.

It's essentially a high-level framework for sending messages between nodes, with options for discovery, robustness, etc.

One useful use case is when you want a client and a server to talk to one another, but without the client actually having the server's address (E.g., you may have more than one server). The client only needs to know the broker and the queue/topic name, and the server can connect as well.

JMS also adds robustness. For instance, you can configure it so that if the server dies while the client sends messages or the other way around, you can still send messages from the client or poll messages from the server. If you ever tried implementing this directly with sockets - it's a nightmare.

The scenario you describe sounds like a classic J2EE problem, why are you not using a J2EE framework? JMS is often used inside J2EE for communications, but you got all the other benefits.

like image 132
Uri Avatar answered Sep 25 '22 20:09

Uri


What ist Java Message Service (JMS) for

JMS is a messaging standard that allows Java EE applications to create, send, receive, and consume messages in a loosely coupled, reliable, and asynchronous way. I'd suggest to read the Java Message Service API Overview for more details.

Why would a need a Standalone Server for Message Processing, vs. e.g. some simple inproc processing with Quartz scheduler?

Sure, in your case, Quartz is an option. But what if the invoice system is a remote system? What if you don't want to wait for the answer? What if the remote system is down when you want to communicate with it? What if the network is not always available? This is where JMS comes in. JMS allows to send a message guaranteed to be delivered and to consume it in a transactional way (sending or consuming a message can be part of a global transaction).

How does it interact with my application?

JMS supports two communication modes: point-to-point and publish/subscribe (if this answers the question).

Isn't it much too slow?

The MOMs I've been working with were blazing fast.

What are Usecases you already implemented successfully?

Used in system such as a reservation application, a banking back-office (processing market data), or more simply to send emails.

See also

  • EJB Message-Driven Beans
like image 27
Pascal Thivent Avatar answered Sep 25 '22 20:09

Pascal Thivent