Class: Droid::ReplyQueue

Inherits:
BaseQueue show all
Defined in:
lib/droid/queue.rb

Instance Attribute Summary

Attributes inherited from BaseQueue

#ex, #mq, #opts, #q, #queue_name

Instance Method Summary collapse

Methods inherited from BaseQueue

#destroy, #log, #tag

Constructor Details

#initialize(queue_name, opts = {}) ⇒ ReplyQueue

Returns a new instance of ReplyQueue.



108
109
110
111
# File 'lib/droid/queue.rb', line 108

def initialize(queue_name, opts={})
  opts[:auto_delete] = true
  super(queue_name, opts)
end

Instance Method Details

#setupObject



113
114
115
116
117
# File 'lib/droid/queue.rb', line 113

def setup
  @mq = MQ.new
  @q = @mq.queue(queue_name, opts)
  @ex = nil
end

#subscribe(amqp_opts = {}, opts = {}) ⇒ Object



123
124
125
126
127
128
# File 'lib/droid/queue.rb', line 123

def subscribe(amqp_opts={}, opts={})
  super(amqp_opts, opts) do |request|
    yield request if block_given?
    self.destroy
  end
end

#teardownObject



130
131
132
133
# File 'lib/droid/queue.rb', line 130

def teardown
  @q.delete
  super
end

#temp?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/droid/queue.rb', line 119

def temp?
  true
end