Is it possible to read stream messages one by one with a replicated consumer? If yes, how to do it? My situation is: I have one service-consumer with 3 replications. I want it to read stream messages as like from queue, when one message is processed only by a single instance(replication). I found that we can set a consumer name, but don't know how to do it in node.js-amqplib library. Also don't know will it help or not.
Asked
Active
Viewed 30 times
0
-
There is no need to do anything... rabbitmq will always send the message only once, so even if there are 3 consumers, only one will get the message – Salketer Jun 28 '23 at 12:19
-
As I've tested, for streams the message is send to the all consumers. I found one solution: use single active consumer. Here you can give a name to your consumer, and only one replication will read the messages. But also it doesn't operate as queue, no opportunity to read(only once) messages in parallel by several replications of the same service. – Yerbol Suleimanov Jul 06 '23 at 14:05
-
Oh sorry, I never used streams, only queues. I thought it was the same. – Salketer Jul 07 '23 at 10:24