Class: HotBunnies::Queue::AsyncCallbackConsumer

Inherits:
CallbackConsumer show all
Defined in:
lib/hot_bunnies/queue.rb

Instance Method Summary collapse

Methods inherited from CallbackConsumer

#callback

Methods inherited from BaseConsumer

#cancel, #handleCancel, #handleCancelOk, #handleDelivery, #start

Constructor Details

#initialize(channel, callback, executor) ⇒ AsyncCallbackConsumer

Returns a new instance of AsyncCallbackConsumer.



203
204
205
206
207
# File 'lib/hot_bunnies/queue.rb', line 203

def initialize(channel, callback, executor)
  super(channel, callback)
  @executor = executor
  @tasks = []
end

Instance Method Details

#deliver(headers, message) ⇒ Object



209
210
211
212
213
214
215
# File 'lib/hot_bunnies/queue.rb', line 209

def deliver(headers, message)
  unless @executor.shutdown?
    @executor.submit do
      callback(headers, message)
    end
  end
end