0
votes

I'm new to rabbit, and need help with setting up default max messages in queue. The idea is that one publisher sends messages. And all the subscribers receive all messages. And I did it by creating different queues for subscribers... no problem with that. But then, when publisher sends the message and the subscriver is offline, the message stores in queue, after the subscriber comes back he receives all stored messages. So i want all queues not to store the messages if it cant be delivered now.

i use windows version of rabbitmq 3.7.2

tried tu use policy like rabbitmqctl.bat set_policy my-pol "" "{""max-length"":1,""overflow"":""reject-publish""}" --apply-to queues and got not enough params error

1

1 Answers

0
votes

You've got two ways of doing this, and combination of them might work for you as well:

  • Set queue properties durable to false and auto-delete to true. That way once your client disconnects, the queue is deleted automatically.

  • As you mentioned, set max-length policy:

    rabbitmqctl set_policy my-pol ".*" '{"max-length":1,"overflow":"reject-publish"}' --apply-to queues

    Second argument here is a regex which should match the queue, so I guess that's what RMQ complains about being missing.