Reputation: 2492
I create a queue:
_channel = rmqConnection.CreateModel();
_channel.QueueDeclare("myqueue", false, false, false, null);
_channel.BasicAcks += _channel_BasicAcks;
_channel.BasicNacks += _channel_BasicNacks;
_channel.BasicRecoverOk += _channel_BasicRecoverOk;
_channel.BasicReturn += _channel_BasicReturn;
_channel.CallbackException += _channel_CallbackException;
_channel.FlowControl += _channel_FlowControl;
_channel.ModelShutdown += _channel_ModelShutdown;
and then i want to subscribe on event when (and if) queue will remove. So, when i manual remove a queue for test this: i can not handle event.
How can i handle event about queue remove\destroy?
P.S. add some new code:
var consumer = new EventingBasicConsumer(_channel);
consumer.Received += OnMessageRecieved;
consumer.ConsumerCancelled += Consumer_ConsumerCancelled;
consumer.Registered += Consumer_Registered;
consumer.Shutdown += Consumer_Shutdown;
consumer.Unregistered += Consumer_Unregistered;
_channel.BasicConsume(SharebleConst.RmqQueueName, false, consumer);
When queue created, Consumer_Registered
rises.
When i remove queue, Consumer_ConsumerCancelled
rises
Upvotes: 0
Views: 89
Reputation: 22682
There is not a way to get notified if a queue is deleted.
You could implement your own tool to do that, using a notification exchange and send a message each time you create or destroy a queue.
or in genral, send changing status messages
Upvotes: 1