Ability for 'REP' to 'autoDelete'
We have various services which expose functionality via 'Req/Rep' messaging pattern. However, when the services come down, their queues remain. I would like to be able to specify the "autoDelete" flag.
For example:
this.rabbitContext.socket('REP', {expiration: constants.queue.timeout, autoDelete: true});
Any thoughts as to why this would not be a good idea?
Any thoughts as to why this would not be a good idea?
'auto-delete' means the queue will be deleted once there are no consumers; for example, if you connect a REP socket to 'foo' with auto-delete then close the socket, 'foo' will get deleted.
The trouble is we want this to work for both REP and REQ sockets; that is, we want the queue to be deleted only when there are no REP sockets and no REQ sockets connected. Otherwise, we could have a REQ socket sending its requests into the void with no chance of a reply, even if a REP socket comes along later.
However, because REQ sockets don't consume from the queue, there's no way for them to prevent the queue from being deleted.