Skip to content

Commit

Permalink
Added queue delete
Browse files Browse the repository at this point in the history
  • Loading branch information
timhonders committed Oct 20, 2017
1 parent e188454 commit ed4756e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions lib/Queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit ed4756e

Please sign in to comment.