Permalink
Browse files

delete queue

  • Loading branch information...
1 parent 571a36f commit 12446f3b2c7163856379edda373938ea8230d0a5 @snscaimito committed Feb 13, 2012
Showing with 22 additions and 0 deletions.
  1. +11 −0 lib/rmq/queue_manager.rb
  2. +11 −0 spec/rmq/rmq_spec.rb
View
@@ -82,5 +82,16 @@ def create_queue(queue_name)
delete_bag(responsebag_handle)
end
+ def delete_queue(queue_name)
+ adminbag_handle = create_admin_bag
+ responsebag_handle = create_response_bag
+ add_string_to_bag(adminbag_handle, MQCA_Q_NAME, queue_name)
+
+ execute(@hconn, MQCMD_DELETE_Q, MQHB_NONE, adminbag_handle, responsebag_handle, MQHO_NONE, MQHO_NONE)
+
+ delete_bag(adminbag_handle)
+ delete_bag(responsebag_handle)
+ end
+
end
end
View
@@ -24,6 +24,8 @@
queue = @qm.create_queue("RMQ.SAMPLE")
@qm.find_queue("RMQ.SAMPLE").should_not be_nil
+
+ @qm.delete_queue("RMQ.SAMPLE")
end
it "should find an existing queue" do
@@ -36,4 +38,13 @@
@qm.find_queue("DOES_NOT_EXIST").should be_nil
end
+ it "should delete a queue" do
+ @qm = RMQ::QueueManager::connect(SpecHelper::DATA[:queue_manager])
+ @qm.create_queue("RMQ.SAMPLE")
+ @qm.find_queue("RMQ.SAMPLE").should_not be_nil
+
+ @qm.delete_queue("RMQ.SAMPLE")
+ @qm.find_queue("RMQ.SAMPLE").should be_nil
+ end
+
end

0 comments on commit 12446f3

Please sign in to comment.