lib/amqp/queue.rb in famoseagle-carrot-0.5.0 vs lib/amqp/queue.rb in famoseagle-carrot-0.6.0
- old
+ new
@@ -1,14 +1,15 @@
module Carrot::AMQP
class Queue
- attr_reader :name, :server
+ attr_reader :name, :server, :carrot
attr_accessor :delivery_tag
- def initialize(server, name, opts = {})
- @server = server
+ def initialize(carrot, name, opts = {})
+ @server = carrot.server
@opts = opts
@name = name
+ @carrot = carrot
server.send_frame(
Protocol::Queue::Declare.new({ :queue => name, :nowait => true }.merge(opts))
)
end
@@ -76,14 +77,15 @@
def delete(opts = {})
server.send_frame(
Protocol::Queue::Delete.new({ :queue => name, :nowait => true }.merge(opts))
)
+ carrot.queues.delete(name)
end
private
def exchange
- @exchange ||= Exchange.new(server, :direct, '', :key => name)
+ @exchange ||= Exchange.new(carrot, :direct, '', :key => name)
end
def bindings
@bindings ||= {}
end