class Msgr::Consumer

Attributes

auto_ack[W]
message[R]

Public Class Methods

auto_ack?() click to toggle source
# File lib/msgr/consumer.rb, line 14
def auto_ack?
  @auto_ack || @auto_ack.nil?
end

Public Instance Methods

dispatch(message) click to toggle source
# File lib/msgr/consumer.rb, line 21
def dispatch(message)
  @message = message

  action = message.route.action.to_sym

  unless respond_to?(action)
    raise Msgr::NoAction.new \
      "No action `#{action}` for `#{self.class.name}`."
  end

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

  send action

  log(:debug) { "Action #{action.inspect} done." }
end
publish(data, opts = {}) click to toggle source
# File lib/msgr/consumer.rb, line 38
def publish(data, opts = {})
  Msgr.client.publish(data, opts)
end