Class: Superbolt::Runner::Pop

Inherits:
Base
  • Object
show all
Defined in:
lib/superbolt/runner/pop.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#block, #error_notifier, #logger, #queue

Instance Method Summary collapse

Methods inherited from Base

#channel, #initialize, #on_error

Constructor Details

This class inherits a constructor from Superbolt::Runner::Base

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/superbolt/runner/pop.rb', line 4

def message
  @message
end

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/superbolt/runner/pop.rb', line 6

def run
  queue.subscribe(ack: false, block: true) do |delivery_info, , payload|
    @message = IncomingMessage.new(delivery_info, payload, channel)
    processor = Processor.new(message, logger, &block)
    unless processor.perform
      on_error(message.parse, processor.exception) if message.parse
    end
    @message = nil
  end
end