1
votes

I'm working on an application in microservices architecture usingrabbitmq as messaging system.

calls between microservices are asynchronous http requests and each service is subscribed on specific queues

my question is seen that the calls are stateless, how to guarantee the parallelisation of the message commation not by routing-key in rabbitmq queue but by http call itself, that is to say for n call every service must be able to listen to only needed messages .

2
Why don't calls between services go though rabbit? - OneCricketeer
This is the case, the data is transferred through RabbitMQ, I want to be sure that for any http request (which differs for example by the parameters), Rabbit lsitener must read only the associated message - KimB
To be honest I don't understand the question. You are using the REST API? I recommend using the client libraries, you'll get better performance and reliability. - Vanlightly
If you need RPC then RabbitMQ has Direct Reply-To which avoids much of the complexity of using reply queues: rabbitmq.com/direct-reply-to.html - Vanlightly

2 Answers

0
votes

Not sure I understood the question completely, but here is what I can suggest based on the description:

If each service is hooked to a particular listener and you don't want to associate a Routing-Key for the Queue+Listener integration, then can you try having header arguments. [You can use a QueueBuilder.withArguments API to set specific Header values that the Queue is supposed to listen to] There needs to be a mechanism through which an exchange will bind to a particular queue and consequently to a Listener service.

Publisher -> Exchange ---> (with headers) binds to Queue -> Listener

0
votes

Sorry for the ambiguity, I'm trying to explain further:

The scenario is that we are in a micro service architecture, due to huge data response the call service will receive the answer in the listener rabbitmq queue.

So let's imagine that two calls are made simultaneously and both queries start loading data into the same queue, the calling service is waiting for messages and adds the received messages but cannot differentiate between the data of caller 1 and caller 2.

Is there a better implementation for the listener