38

I was reading this question and the corresponding answer and got confused by the term JMS broker in the first line of the answer :

MS (ActiveMQ is a JMS broker implementation)

I want to know what exactly is a JMS broker and what are its responsibilities ?

Wikipedia page on JMS lists out several elemnents in JMS eco system but doesn't mention about brokers as such.

Community
  • 1
  • 1
Geek
  • 26,489
  • 43
  • 149
  • 227

1 Answers1

53

There is not really an official definition for what a JMS broker is, but there is conceptual difference between a message queue and broker. Here is my take on it.

  • A message queue only looks at the message headers to figure out where to send the message, the message queue does not examine the message body or execute any code that transforms the content of the message body. Message queue mission is to deliver message, eventually, once and only once, and in order that they were sent.
  • A message broker provides a programming environment where you can write message transformation code easily and efficiently. For example you might need to transform the content of a message from format A to format B and you don't want old clients that use format A to have to be re-written so you write a message translator program and deploy it to the message broker. In this case the message broker will be a separate process possibly running on a separate machine that is responsible for running message processing code.

The big value of message brokers is that they can do some really nice things for you for handling message concurrently, fail-over for processing logic, deploying of processing logic, monitoring and logging ... etc. Think of a message broker as a specialized application server for writing message processing code, possibly in a custom high level language. For example IBM message broker can be programmed in a ESQL an extension of SQL along with a diagrams and nodes that you connect with each other. Programs written for a message borker will be shorter than if you wrote all the code yourself using plain JMS.

Brokers can be centralized or distributed, so for example you can have a central broker in New York, an have clients in London and Hong kong connected to it. Or you could have the broker be distributed and have an instance running in London and Hong kong which do the message processing closer to the source / destination of the message, it will all depend on your management infrastructure and what other resources like databases the message broker needs to talk to.

Geek
  • 26,489
  • 43
  • 149
  • 227
ams
  • 60,316
  • 68
  • 200
  • 288