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.



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

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

Instance Method Details

#setupObject



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

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

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



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

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

#teardownObject



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

def teardown
	@q.delete
	super
end

#temp?Boolean

Returns:

  • (Boolean)


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

def temp?
	true
end