Module: Emque::Consuming::Consumer::Common

Defined in:
lib/emque/consuming/consumer/common.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(descendant) ⇒ Object



16
17
18
19
20
# File 'lib/emque/consuming/consumer/common.rb', line 16

def self.included(descendant)
  descendant.class_eval do
    attr_reader :message
  end
end

Instance Method Details

#consume(handler_method, message) ⇒ Object



22
23
24
# File 'lib/emque/consuming/consumer/common.rb', line 22

def consume(handler_method, message)
  send(handler_method, message)
end

#pipe_configObject



26
27
28
29
30
# File 'lib/emque/consuming/consumer/common.rb', line 26

def pipe_config
  @pipe_config ||= Pipe::Config.new(
    :stop_on => ->(msg, _, _) { !(msg.respond_to?(:continue?) && msg.continue?) }
  )
end