Sha256: bb57ccbe59546faaca0ec28529167c53ec24ad4a223fccadcb0a582558b71cae

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

require "alephant/publisher/queue/writer"

module Alephant
  module Publisher
    module Queue
      class Processor
        attr_reader :opts

        def initialize(opts = nil)
          @opts = opts
        end

        def consume(msg)
          return if msg.nil?
          write(msg)
          msg.delete
        end

        private

        def writer_config
          opts ? opts.writer : {}
        end

        def write(msg)
          Writer.new(writer_config, msg).run!
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alephant-publisher-queue-2.5.0 lib/alephant/publisher/queue/processor.rb
alephant-publisher-queue-2.4.2 lib/alephant/publisher/queue/processor.rb
alephant-publisher-queue-2.4.1 lib/alephant/publisher/queue/processor.rb
alephant-publisher-queue-2.4.0 lib/alephant/publisher/queue/processor.rb