Disconnect a socket from a target
Worth having a way to unsubscribe a SUB (and the equivalent for other sockets?). Among other things this would delete the appropriate resources (ifUnused).
I totally agree, now I have a project I need to cancel this sentence "this.client.connect" when the user leaves the channel and I cant do.
Thinking aloud: is Socket#destroy() appropriate for this?
Among other things this would delete the appropriate resources (ifUnused).
Unfortunately this won't work, for a couple of reasons. Firstly, AMQP is stupid (who knew?): ifUnused will cause the channel to break should the queue or exchange be in fact used. Secondly, it wouldn't help anyway, because "used" means the wrong thing from our point of view. In the case of exchanges, it means bindings from the exchange, which won't always be in place (e.g., if there are no sub sockets at the time). In the case of queues, it means consumers, which again may not be in place.
Thinking aloud: is Socket#destroy() appropriate for this?
No, of course not, me. That's for invalidating the whole socket.
Among other things this would delete the appropriate resources (ifUnused).
I can't think of a way to make sure exchanges are garbage collected.