Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it appropriate to use message queues for synchronous rpc calls via ajax

Tags:

soa

rabbitmq

rpc

I have a web application that uses the jquery autocomplete plugin, which essentially sends via ajax a request containing text that has been typed into a textbox to our web server, once the web server receives this request, it is then handed off to rabbitmq.

I know that we do get benefits from using messaging, but it seems like using it for blocking rpc calls is a misuse and that something like WCF is far more appropriate in this instance, is this the case or is it considered acceptable architecture?

like image 564
nickbw Avatar asked Apr 01 '14 22:04

nickbw


People also ask

Are message queues synchronous?

Message queues implement an asynchronous communication pattern between two or more processes/threads whereby the sending and receiving party do not need to interact with the message queue at the same time.

When should message queue be used?

Queues make your data persistent, and reduce the errors that happen when different parts of your system go offline. By separating different components with message queues, you create more fault tolerance. If one part of the system is ever unreachable, the other can still continue to interact with the queue.

Is RabbitMQ synchronous or asynchronous?

RabbitMQ includes a wide variety of features that make it useful when building distributed systems that communicate via asynchronous messaging. To get started, reading our RabbitMQ - Getting started guide is a great way to learn more about message queue architecture!

Do message queues decrease performance?

The Message Queue persistent store must be updated with the acknowledgment information for all persistent messages received by consumers, thereby decreasing performance.


1 Answers

It's possible to perform RPC synchronous requests with RabbitMQ. Here it's explained very well, with its drawback included! So it's considered an acceptable architecture. Discouraged, but acceptable whenever the synchronous response is mandatory.

As a possible counter-effect is that adding RabbitMQ in the middle, you will add some latency to the solution.

However you have the possibility to gain in terms of reliability, flexibility, scalability,...

like image 133
Sigi Avatar answered Oct 05 '22 14:10

Sigi