53

On my team at work, we use the IBM MQ technology a lot for cross-application communication. I've seen lately on Hacker News and other places about other MQ technologies like RabbitMQ. I have a basic understanding of what it is (a commonly checked area to put and get messages), but what I want to know what exactly is it good at? How will I know where I want to use it and when? Why not just stick with more rudimentary forms of interprocess messaging?

5 Answers 5

87

All the explanations so far are accurate and to the point - but might be missing something: one of the main benefits of message queueing: resilience.

Imagine this: you need to communicate with two or three other systems. A common approach these days will be web services which is fine if you need an answers right away.

However: web services can be down and not available - what do you do then? Putting your message into a message queue (which has a component on your machine/server, too) typically will work in this scenario - your message just doesn't get delivered and thus processed right now - but it will later on, when the other side of the service comes back online.

So in many cases, using message queues to connect disparate systems is a more reliable, more robust way of sending messages back and forth. It doesn't work well for everything (if you want to know the current stock price for MSFT, putting that request into a queue might not be the best of ideas) - but in lots of cases, like putting an order into your supplier's message queue, it works really well and can help ease some of the reliability issues with other technologies.

4
  • 3
    So what do you do if the MQ server is down? It's no more resilient than a web service, is it?
    – Rob Holmes
    Commented Apr 14, 2015 at 17:29
  • 5
    @RobHolmes: typically, you can still enqueue it into your local queue - it will be transmitted to the queue server when it's back up - and yes, it IS more resilient than a typical web service .....
    – marc_s
    Commented Apr 14, 2015 at 18:16
  • @marc_s, how do we enqueue to local queue in RabbitMQ? How does it get synchronized to queue on MQ Server?
    – techspider
    Commented Mar 21, 2016 at 17:59
  • 3
    how do you measure software resilience? why we should accept a mq is more resilient than a web service? Commented Feb 26, 2021 at 12:11
20

MQ stands for messaging queue.

It's an abstraction layer that allows multiple processes (likely on different machines) to communicate via various models (e.g., point-to-point, publish subscribe, etc.). Depending on the implementation, it can be configured for things like guaranteed reliability, error reporting, security, discovery, performance, etc.

You can do all this manually with sockets, but it's very difficult.

For example: Suppose you want to processes to communicate, but one of them can die in the middle and later get reconnected. How would you ensure that interim messages were not lost? MQ solutions can do that for you.

12

Message queueuing systems are supposed to give you several bonuses. Among most important ones are monitoring and transactional behavior.

Transactional design is important if you want to be immune to failures, such as power failure. Imagine that you want to notify a bank system of ATM money withdrawal, and it has to be done exactly once per request, no matter what servers failed temporarily in the middle. MQ systems would allow you to coordinate transactions across multiple database, MQ and other systems.

Needless to say, such systems are very slow compared to named pipes, TCP or other non-transactional tools. If high performance is required, you would not allow your messages to be written thru disk. Instead, it will complicate your design - to achieve exotic reliable AND fast communication, which pushes the designer into really non-trivial tricks.

MQ systems normally allow users to watch the queue contents, write plugins, clear queus, etc.

0
4

MQ simply stands for Message Queue.

You would use one when you need to reliably send a inter-process/cross-platform/cross-application message that isn't time dependent.

The Message Queue receives the message, places it in the proper queue, and waits for the application to retrieve the message when ready.

1
  • 2
    So it sounds like MQs are technologies that sacrifice performance for reliability generally?
    – Harvey Lin
    Commented Apr 16, 2018 at 18:00
0

reference: web services can be down and not available - what do you do then? As an extension to that; what if your local network and your local pc is down as well?? While you wait for the system to recover the dependent deployed systems elsewhere waiting for that data needs to see an alternative data stream. Otherwise, that might not be good enough 'real time' response for today's and very soon in the future Internet of Things (IOT) requirements.

if you want true parallel, non volatile storage of various FIFO streams(at least at some point along the signal chain) use an FPGA and FRAM memory. FRAM runs at clock speed and FPGA devices can be reprogrammed on the fly adding and taking away however many independent parallel data streams are needed(within established constraints of course).

Not the answer you're looking for? Browse other questions tagged or ask your own question.