Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is it appropriate to use AMQP? [closed]

Tags:

rabbitmq

amqp

On my previous job I used benefits of AMQP, but I was not involved in rabbitMQ subproject development. On my current job I want to take charge of integrating one of AMQP implementations (probably rabbitMQ). The issue here that I have to convinced my Boss in using AMQP.

I am reading "RabbitMQ in Action" and Mr. Videla wrote that AMQP could improve any system, but I do not see how I can improve my project. We use only 2 servers making API calls in between, so we do not have scalability problem right now. We deal with real money flows and this means we need success confirmation for any operation, i.e. I can not put task in queue and "forget" about it. What benefits could AMQP bring in this case?

Could you please provide couple real world examples for relatively small systems when you do not need to scale hardly? Please omit standard "logging" and "broadcast message" situations :)

like image 499
user2066983 Avatar asked Feb 13 '13 04:02

user2066983


People also ask

What is AMQP used for?

The Advanced Message Queuing Protocol (AMQP) is an open standard for passing business messages between applications or organizations. It connects systems, feeds business processes with the information they need and reliably transmits onward the instructions that achieve their goals.

Should I close RabbitMQ connection?

Don't open and close connections or channels repeatedly. Even channels should be long-lived if possible, e.g., reuse the same channel per thread for publishing. Don't open a channel each time you are publishing. If you can't have long-lived connections, then make sure to gracefully close the connection.

How do I close an AMQP connection?

A connection can be closed via the RabbitMQ Management Interface. Enter the connection tab and press on the connection. Go to the bottom of the page and press Close this connection, followed by pressing Force Close.

Is AMQP faster than HTTP?

The results showed that MQTT and AMQP are four times faster than HTTP protocol when comparing the message sent latencies.


1 Answers

It sounds like all you need is RPC. Rabbit is not known for RPC but it actually does a really good job because:

  • You can make many messages transactional (ie all in one transaction)
  • Its platform, language and protocol format agnostic (ie you could send binary over)
  • Because of the broker idea you can easily add more servers to handle the procedures.
  • You can easily see the message flow and rate with RabbitMQ's admin UI
  • RabbitMQ is sort of an inversion of control at the architecture level
  • In RabbitMQ the message is the contract... not the procedure. This is the right way to do it.

Now lets compare this to say SOAP:

  • SOAP does not give you a broker or routing so all your severs need to know about each other. I can't tell you how annoying it is to have to go plugin IP address for dev, staging, production.
  • SOAP does not provide transactions. You have to do that yourself.
  • SOAP you have to use XML
  • There are more reliable RabbitMQ clients than SOAP clients. SOAP compatibility is a PITA.
  • SOAP you have the message and the endpoint. In some cases this is a pro.

You don't have to use RabbitMQ to use the idea of a eventbus/messagebus. I personally would not make any sort of app with out one because going from pure synchronous RPC to a asynchronous eventbus/messagebus require lots of work. Better to do it right from the beginning.

like image 169
Adam Gent Avatar answered Nov 15 '22 13:11

Adam Gent