Class: Freddy::ResponderHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/freddy/responder_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(consumer, consume_thread_pool) ⇒ ResponderHandler

Returns a new instance of ResponderHandler.



5
6
7
8
# File 'lib/freddy/responder_handler.rb', line 5

def initialize(consumer, consume_thread_pool)
  @consumer = consumer
  @consume_thread_pool = consume_thread_pool
end

Instance Method Details

#shutdownvoid

This method returns an undefined value.

Shutdown responder

Stop responding to messages immediately, Waits until all workers are finished and then returns.

Examples:

responder = freddy.respond_to 'Queue' do |msg, handler|
end
responder.shutdown


21
22
23
24
25
# File 'lib/freddy/responder_handler.rb', line 21

def shutdown
  @consumer.cancel
  @consume_thread_pool.shutdown
  @consume_thread_pool.wait_for_termination
end