Answer the question
In order to leave comments, you need to log in
How to configure RabbitMQ in API Gateway with the ability to return the data requested by the client?
Hello!
I'm trying to set up api gateway (krakend) to communicate with services asynchronously via rabbitmq and I have approximately managed to set up a queue for such communication...
The scheme is as follows:
client(http client) -> api gateway(krakend) -> queue(rabbitmq) - > services
But I ran into a wall when I got to the point where I need to return the data requested to the client in turn.
I don’t know how to implement this, I wanted to ask if it is possible to organize such a queue and somehow recognize the right client and send him exactly the data that he requested?
For example, let's say there are 3 customers:
1 customer asks for a list of products;
2 the client asks for a list of categories;
3 the client asks for a list of users.
All these requests go through the chain to the services and the services give this data through one queue and the kraken that listens to this queue takes this data and gives it to the client upon request. Here somehow it is necessary to define and distinguish clients, so as not to give the wrong data to the client.
Suppose a client has requested a list of products, and we give him a list of users, this will be a mistake.
Communication scheme: services -> queue (rabbitmq) -> api gateway (krakend) -> client (http client)
Yes, here you can separate requests by type and throw them into different queues, but I will have excellent data in one queue anyway , which will need to be given to different clients (for example, if these are goods, then one client requested certain iPhones, and another client requested androids).
Can anyone suggest how this can be properly organized?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question