在Nestjs中缩放基于兔子的微服务
我需要在Nestjs中创建一个基于RabbitMQ的微服务解决方案。为了扩展系统,我需要部署同一微服务(服务器)的几个实例(例如,3个码头)收听相同的RabbitMQ主题,处理来自消费者(客户端)的处理请求(请参见下图)。我假设这三个实例使用一种循环的罗宾来弹出来自队列/主题的消息/请求并处理它们,然后将结果返回另一个队列(即'charback'queue)中的结果。我想知道
- Nestjs是否已经处理了相关性_id(将响应与请求|解决问题相关联,在该排队中收到响应后,尚不清楚该响应属于哪个请求。)当前图书馆?
- NESTJS是否会创建独家回调队列(部署了相同微服务的几个实例),或者我需要在我的代码中自己照顾它(即工人(aka:server | server | microservice)正在等待该排队的请求出现请求时,它可以使用Reply_to field的队列将结果发送给客户/消费者。换句话说,客户(消费者)等待回调队列上的数据。出现消息时,它会检查Correlation_ID属性。如果它与请求的值匹配,则将返回到应用程序的响应。
I need to create a RabbitMQ-based microservices solution in Nestjs. To scale the system, I need to deploy several instances (e.g., 3 dockers) of the same microservice (server) listening to the same RabbitMQ topic, processing requests coming from the consumer (client) (see the following figure). I assume these 3 instances use a kind of Round Robin to pop up messages/requests from the queue/topic and process them and then return the results in another queue (i.e., 'callback' queue) to the consumer. I am wondering if
- Nestjs already handles the correlation_id (to correlate responses with requests | to tackle the issue, having received a response in that queue it's not clear to which request the response belongs.) under the hood, or do I need to extend the current library?
- Does NestJs create an exclusive callback queue (when several instances of the same microservices are deployed) or do I need to take care of that myself in my code (i.e., The worker (aka: server | microservice) is waiting for requests on that queue. When a request appears, it does the job and sends a message with the result back to the Client/Consumer, using the queue from the reply_to field.). In other words, The client (consumer) waits for data on the callback queue. When a message appears, it checks the correlation_id property. If it matches the value from the request it returns the response to the application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论