diff --git a/android/src/main/java/nl/kega/reactnativerabbitmq/RabbitMqConnection.java b/android/src/main/java/nl/kega/reactnativerabbitmq/RabbitMqConnection.java index 7114545..d8a13be 100644 --- a/android/src/main/java/nl/kega/reactnativerabbitmq/RabbitMqConnection.java +++ b/android/src/main/java/nl/kega/reactnativerabbitmq/RabbitMqConnection.java @@ -198,9 +198,19 @@ public void unbindQueue(String exchange_name, String queue_name) { } @ReactMethod - public void removeQueue() { - + public void removeQueue(String queue_name) { + RabbitMqQueue found_queue = null; + for (RabbitMqQueue queue : queues) { + if (Objects.equals(queue_name, queue.name)){ + found_queue = queue; + } + } + + if (!found_queue.equals(null)){ + found_queue.delete(); + } } + /* @ReactMethod public void publishToQueue(String message, String exchange_name, String routing_key) { diff --git a/lib/Queue.js b/lib/Queue.js index 6c7b8c9..60d392a 100644 --- a/lib/Queue.js +++ b/lib/Queue.js @@ -67,6 +67,10 @@ export class Queue { this.rabbitmqconnection.unbindQueue(exchange.name, this.name, routing_key); } + delete(){ + this.rabbitmqconnection.removeQueue(this.name); + } + close() { DeviceEventEmitter.removeListener('RabbitMqQueueEvent', this.handleEvent.bind(this)); this.callbacks = [];