rabbit.js icon indicating copy to clipboard operation
rabbit.js copied to clipboard

Ability for 'REP' to 'autoDelete'

Open utestmig opened this issue 11 years ago • 1 comments

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?

utestmig avatar Sep 03 '14 14:09 utestmig

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.

squaremo avatar Mar 14 '15 16:03 squaremo