Sha256: c1f2fae5e069eb503ef0dbeaf7814f641ec58510f1140b21e37ea240910ba7d3
Contents?: true
Size: 701 Bytes
Versions: 24
Compression:
Stored size: 701 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
24 entries across 24 versions & 1 rubygems