I am using RabbitMQ to route messages to interested subscribers by topic. Each subscriber has a queue, and I bind the queue to the topics they are interested in. I would like to allow the user to remove an item from their topic list.
In my setup, that would require "unbinding" the bound topic from that user's queue.
I am using pyamqplib, and I am not seeing a way to do this via the channel object. Is their a way to remove previously bound routing keys from a queue?
Working in Python?
Looks to me like pika 0.13 has an unbind method:
queue_unbind(queue, exchange=None, routing_key=None, arguments=None, callback=None)
public void unsubscribe(String queuename, String topic) throws IOException
{
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(MQ_HOST);
factory.setPort(MQ_PORT);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
try
{
channel.exchangeDeclarePassive("Channel name");
channel.queueUnbind(queuename, "Channel name", topic);
}
finally
{
handleClose(connection, channel);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With