Sha256: 2903b6897c5df1bd6d8fe73585eeb1c69d4210f456245c74ffcf8360caa86f0c

Contents?: true

Size: 640 Bytes

Versions: 32

Compression:

Stored size: 640 Bytes

Contents

module Msgr

  class Consumer
    include Logging

    attr_reader :message
    delegate :payload, to: :@message
    delegate :action, to: :'@message.route'
    delegate :consumer, to: :'@message.consumer'

    def dispatch(message)
      @message = message

      action = message.route.action.to_sym
      raise Msgr::NoAction.new "No action `#{action}` for `#{self.class.name}`." unless respond_to? action

      log(:debug) { "Invoke action #{action.inspect}." }

      send action

      log(:debug) { "Action #{action.inspect} done." }
    end

    def publish(data, opts = {})
      Msgr.client.publish(data, opts)
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
msgr-0.14.1.1.b125 lib/msgr/consumer.rb
msgr-0.14.1.1.b124 lib/msgr/consumer.rb
msgr-0.14.1.1.b112 lib/msgr/consumer.rb
msgr-0.14.1.1.b111 lib/msgr/consumer.rb
msgr-0.14.1.1.b110 lib/msgr/consumer.rb
msgr-0.14.1 lib/msgr/consumer.rb
msgr-0.14.0 lib/msgr/consumer.rb
msgr-0.13.0 lib/msgr/consumer.rb
msgr-0.12.3 lib/msgr/consumer.rb
msgr-0.12.2 lib/msgr/consumer.rb
msgr-0.12.1 lib/msgr/consumer.rb
msgr-0.12.0 lib/msgr/consumer.rb
msgr-0.11.1 lib/msgr/consumer.rb
msgr-0.11.0 lib/msgr/consumer.rb
msgr-0.11.0.rc3 lib/msgr/consumer.rb
msgr-0.11.0.rc2 lib/msgr/consumer.rb
msgr-0.11.0.rc1 lib/msgr/consumer.rb
msgr-0.10.2 lib/msgr/consumer.rb
msgr-0.10.1 lib/msgr/consumer.rb
msgr-0.10.0 lib/msgr/consumer.rb