Created
August 6, 2012 07:31
-
-
Save jshiell/3271941 to your computer and use it in GitHub Desktop.
Unbind and delete a queue from a RabbitMQ node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.rabbitmq.client.Channel; | |
import com.rabbitmq.client.Connection; | |
import com.rabbitmq.client.ConnectionFactory; | |
import java.io.IOException; | |
public class Unbinder { | |
public static void main(final String[] args) { | |
final ConnectionFactory factory = new ConnectionFactory(); | |
factory.setHost("aServer"); | |
factory.setPort(5672); | |
factory.setUsername("aUser"); | |
factory.setPassword("aPassword"); | |
factory.setVirtualHost("aVHost"); | |
try { | |
final Connection connection = factory.newConnection(); | |
final Channel channel = connection.createChannel(); | |
try { | |
channel.exchangeDeclarePassive("anExchange"); | |
channel.queueUnbind("aQueue", "anExchange", "aRoutingKey"); | |
channel.queueDelete("aQueue"); | |
} finally { | |
channel.close(); | |
connection.close(); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment