You need a solid queue for storing messages if there are no connected consumers available to process messages at the time of publication.
An exchange does not save messages, but may be in a queue. The confusing part is that the exchange may be marked as βdurableβ, but all that really means is that the exchange itself will still be present if you restart your broker, but it does not mean that any messages sent that the exchange is automatically saved.
Given this, here are two options:
- Complete the administrative step before starting the publishers to create the queue (s) yourself. You can use the web interface or command line tools for this. Make sure you create it as a solid queue so that it saves any messages that have been redirected to it, even if there are no active users.
- Assuming that your consumers are encoded to always announce (and therefore automatically create) their exchanges and queues at startup (and declare them as long-lived), simply launch all their consumers at least once before starting with any publishers. This will ensure that all your queues are created correctly. Then you can disconnect consumers until they are really needed, because the queues will constantly store any future messages sent to them.
I would go to # 1. There cannot be many steps to complete, and you can always script to complete the necessary steps so that they can be repeated. Plus, if all your consumers will be pulling from the same queue (and not have a dedicated queue), this is really the minimum part of the administrative overhead.
Queues are what you need to control and control. Otherwise, you may end up rogue consumers declaring strong lines, using them within minutes, but never again. Soon after you have a constantly growing line, nothing will reduce its size and the impending broker's apocalypse.
Brian Kelly May 27 '11 at 17:29 2011-05-27 17:29
source share