Skip to content
Snippets Groups Projects
Commit dc224792 authored by Simon Spinner's avatar Simon Spinner
Browse files

Add methods to remove queues and exchanges.

parent c173985a
No related branches found
No related tags found
No related merge requests found
......@@ -32,4 +32,12 @@ public class TestMessageBus implements MessageBus {
public void publishMessage(String exchange, String routingKey, String message, Map<String, Object> headers) {
}
@Override
public void removeQueue(String queue) {
}
@Override
public void removeExchange(String exchange) {
}
}
......@@ -18,8 +18,12 @@ public interface MessageBus {
void createQueue(String queue);
void removeQueue(String queue);
void createExchange(String exchange, ExchangeType type);
void removeExchange(String exchange);
void bindQueue(String queue, String exchange, String routingKey);
void addMessageListener(String queue, final Listener listener);
......
......@@ -95,6 +95,15 @@ public class RabbitMQMessageBus implements MessageBus {
}
}
public void removeExchange(String exchange) {
try {
channel.exchangeDelete(exchange);
} catch (IOException e) {
log.error("Error removing exchange in RabbitMQ server", e);
throw new MessagingException(e);
}
}
public void createQueue(String queue) {
try {
channel.queueDeclare(queue, false, false, false, null);
......@@ -104,6 +113,16 @@ public class RabbitMQMessageBus implements MessageBus {
}
}
@Override
public void removeQueue(String queue) {
try {
channel.queueDelete(queue);
} catch (IOException e) {
log.error("Error removing queue in RabbitMQ server", e);
throw new MessagingException(e);
}
}
public void bindQueue(String queue, String exchange, String routingKey) {
try {
channel.queueBind(queue, exchange, routingKey);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment