Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a broker, topic, queue

I tried to find details about broker, topic, queue; but couldn't get good results. I tried to Google on these topics but couldn't find much. Can somebody help explaining these concepts.

like image 474
thegeek Avatar asked Sep 08 '15 04:09

thegeek


People also ask

What is a topic queue?

A topic subscription resembles a virtual queue that receives copies of the messages that are sent to the topic. Consumers receive messages from a subscription identically to the way they receive messages from a queue.

What is a broker in message queue?

A message broker is simply a mechanism that extends the usage of message queues. Unlike message queues, message brokers can read the contents of the information carried through them. Also, message brokers can process information from all sorts of sources. For example, information read from files or HTTP requests.

How does queue and Topic work?

In queue, you only have one receiver or consumer; unlike in topic where in you can have your message be disseminated to a number of subscribers. Also, in topic, the publisher has to be continuously active for a subscriber to receive the messages. Otherwise the message will be reallocated.

What is the difference between queue and Topic in ActiveMQ?

A Topic forwards a message from the producer to many consumers at once. It's a broadcast. This is often called Publish-and-Subscribe (Pub/Sub) messaging. A Queue may also have many consumers, but it forwards each message to only one consumer.


1 Answers

It is true that finding a simple answer is a bit difficult.

I found this Red Hat page with two simple diagram explaining JMS principles. As TIBCO EMS is ALSO an JMS implementation, the same theory about Queue and Topics applies.

To be even more "TIBCO-oriented" in my answer, please refer to page 3 and 4 of the EMS User Guide (latest version).

To summarize:

Queues

  • Are used for "point-to-point" messaging models (it does not mean the whole integration solution should be considered point-to-point, you can do good EAI with Queues).
  • They usually store the messages even if no message consumers are connected.
  • They can be used for asynchronous communications (ex: producer and consumer not available at the same time), load sharing (ie: if more than one consumer, only one will get the message) and overall message based integration (see this book).

Topics

  • Are mainly used for "publish-subscribe" messaging models.
  • Usually, if they are no subscribers, all published messages are "lost" (by design). Durable subscription can compensate for this, and in essence amounts to "pub-sub subscribers queues".

Note: In EMS, Queues and topics can be "chained" by "bridges" to give even more functionality. Others products have similar features.

Broker

A broker typically refer to both the "Message Broker" pattern from the above book reference AND to specialized products. Typically, "broker" is the role of "intelligent integration manager" given to BusinessWorks (or similar products like webMethods IS or IBM Integration Bus / Websphere Message Broker). These products are usually central to any ESB/EAI project, since they tie the messaging system with mapping, programming languages (proprietary or open like Java) and adapters to specific systems (Mainframe, ERP, etc.)

like image 94
GhislainCote Avatar answered Jan 01 '23 02:01

GhislainCote