Skip to content

Commit ed4756e

Browse files
committed
Added queue delete
1 parent e188454 commit ed4756e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

android/src/main/java/nl/kega/reactnativerabbitmq/RabbitMqConnection.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,19 @@ public void unbindQueue(String exchange_name, String queue_name) {
198198
}
199199

200200
@ReactMethod
201-
public void removeQueue() {
202-
201+
public void removeQueue(String queue_name) {
202+
RabbitMqQueue found_queue = null;
203+
for (RabbitMqQueue queue : queues) {
204+
if (Objects.equals(queue_name, queue.name)){
205+
found_queue = queue;
206+
}
207+
}
208+
209+
if (!found_queue.equals(null)){
210+
found_queue.delete();
211+
}
203212
}
213+
204214
/*
205215
@ReactMethod
206216
public void publishToQueue(String message, String exchange_name, String routing_key) {

lib/Queue.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export class Queue {
6767
this.rabbitmqconnection.unbindQueue(exchange.name, this.name, routing_key);
6868
}
6969

70+
delete(){
71+
this.rabbitmqconnection.removeQueue(this.name);
72+
}
73+
7074
close() {
7175
DeviceEventEmitter.removeListener('RabbitMqQueueEvent', this.handleEvent.bind(this));
7276
this.callbacks = [];

0 commit comments

Comments
 (0)