Sha256: 73ca81cba288d5865d8b35a24da4c40fcceffbac107746de8ce793bddf61ddbd

Contents?: true

Size: 869 Bytes

Versions: 8

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

module AdvancedSneakersActiveJob
  class Publisher < ::BunnyPublisher::Base
    include ::BunnyPublisher::Mandatory

    before_publish :log_message

    delegate :logger, to: :'::ActiveJob::Base'

    delegate :handle_unrouted_messages,
             to: :'AdvancedSneakersActiveJob.config',
             prefix: :config

    private

    def log_message(publisher, message, options = {})
      logger.debug do
        "Publishing <#{message}> to [#{publisher.exchange.name}] with routing_key [#{options[:routing_key]}]"
      end
    end

    def on_message_return(return_info, properties, message)
      if config_handle_unrouted_messages
        super
      else
        logger.warn do
          "Message is not routed! #{{ message: message, return_info: return_info, properties: properties }}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
advanced-sneakers-activejob-0.4.0 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.6 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.5 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.4 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.3 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.2 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.1 lib/advanced_sneakers_activejob/publisher.rb
advanced-sneakers-activejob-0.3.0 lib/advanced_sneakers_activejob/publisher.rb