Open Forusim opened 9 years ago
My JavaScript is extremely rusty, but should this not be:
return {
id: headers.id,
unsubscribe: function(headers) {
return client.unsubscribe(id, headers);
}
};
with client.unsubscribe() changed to:
Client.prototype.unsubscribe = function(id, headers) {
delete this.subscriptions[id];
if (headers == null) {
headers = {};
}
headers.id = id;
return this._transmit("UNSUBSCRIBE", headers);
};
so that subscription.unsubscribe() can be called with an optional 'headers' argument? If I'm wrong, corrections are very welcome!
Actually, I found an error myself. Let's try this again. I've tried this and it works, which doesn't mean that the OP's code does not also work.
return {
id: headers.id,
unsubscribe: function(hdrs) {
return client.unsubscribe(headers.id, hdrs);
}
};
In the latest 2.3.4 it is not possible to delete a durable subscription. In the documentation for RabbitMQ or ActiveMQ it is said: "To permanently delete a durable subscription, send an UNSUBSCRIBE frame for the subscription ID with the persistent header set to true."
The easiest way to this, would be to provide the subscription headers to the client.unsubscribe():
The client.unsubscribe() should be changed to this: