1

Currently, we plan to upgrade our product to use MQ(RabbitMQ or ActiveMQ) for message transfer between server and client. And now we are using a network lib(evpp) for doing so.

Because I don't use MQ before, so excpet for a lot of new features of MQ, I can't figure out the essential difference between them, and don't know exactly when and where should we use MQ or just use network library is fine.

And the purpose that we want to use MQ is that we want to solve the unreliability of communication, such as message loss or other problems caused by unstable network environment.

Hope there is someone familiar with both of them could release my confusion. Thanks for advance.

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
Phymin
  • 123
  • 8

2 Answers2

2

Message queuing systems (MQ, Qpid, RabbitMQ, Kafka, etc.) are higher-layer systems purpose-built for handling messages reliably and flexibly.

Network programming libraries/frameworks (ACE, asio, etc.) are helpful tools for building message queueing (and many other types of) systems.

Note that in the case of ACE, which encompasses much more than just networking, you can use a message queuing system like the above and drive it with a program that also uses ACE's classes for thread management, OS abstraction, event handling, etc.

Steve Huston
  • 1,432
  • 13
  • 20
1

Like in any network-programming, when a client sends a request to the server, the server responds with a response. But for this to happen the following conditions must be met

  1. The server must be UP and running
  2. The client should be able to make some sort of connection between them
  3. The connection should not break while the server is sending the response to the client or vice-versa

But in case of a message queue, whatever the server wants to tell the client, the message is placed in a message-queue i.e., separate server/instance. The client listens to the message-queue and processes the message. On a positive acknowledgement from the client, the message is removed from the message queue. Obviously a connection has to made by the server to push a message to the message-queue instance. Even if the client is down, the message stays in the queue.

bumblebee
  • 1,811
  • 12
  • 19
  • Thanks for your reply, and from your explanation, I think MQ can make sure the correctness of the messages under unstable network environment, isn't it? – Phymin May 22 '20 at 08:43
  • Yes, if the client connected to the MQ gets disconnected, the message will still be in the MQ. – bumblebee May 22 '20 at 10:09