Sha256: 41441d4310f6c54bc4b91576bdcf72d2909d9a325cdfe46fa771f8be98a0a9ed
Contents?: true
Size: 702 Bytes
Versions: 12
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true 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 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 def publish(data, opts = {}) Msgr.client.publish(data, opts) end end end
Version data entries
12 entries across 12 versions & 1 rubygems