bashIt
bashIt

Reputation: 1036

Losing the messages sent from publisher while consumers are spawning up in Rabbit mq

I'm just exploring the rabbit mq topics https://www.rabbitmq.com/tutorials/tutorial-five-javascript.html
When I'm running continuously ./receive_logs_topic.js "#" (consumer) and publishing the message it works fine.

But when I kill consumer and send the message via publisher 2-3 times and again launch the consumer then the it's not processing the message which i sent before.

I'm comparing with rabbit queues that whenever the consumer is back it will process the pending messages.

Is topics work in this fashion only or I'm messing with some configuration?

Upvotes: 0

Views: 386

Answers (1)

Luke Bakken
Luke Bakken

Reputation: 9667

When you stop the consumer, the queues and bindings that it had declared will be deleted since they are exclusive queues. Since there is nowhere for RabbitMQ to route the messages, they will be dropped.

To resolve this, you will have to change the code to use well-known queues that both the publisher and consumer declare (with bindings, of course). That way it doesn't matter which process is started.

Upvotes: 1

Related Questions