Class: BBK::AMQP::RejectionPolicies::Reject

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/amqp/rejection_policies/reject.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger: BBK::Utils::Logger.default) ⇒ Reject

Returns a new instance of Reject.



8
9
10
# File 'lib/bbk/amqp/rejection_policies/reject.rb', line 8

def initialize(logger: BBK::Utils::Logger.default)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/bbk/amqp/rejection_policies/reject.rb', line 6

def logger
  @logger
end

Instance Method Details

#call(message, error, *_args, **_kwargs) ⇒ Object



12
13
14
15
# File 'lib/bbk/amqp/rejection_policies/reject.rb', line 12

def call(message, error, *_args, **_kwargs)
  logger.debug "Reject message #{message.headers[:type]}[#{message.headers[:message_id]}] delivery tag: #{message.delivery_info[:delivery_tag].to_i}. Error: #{error.inspect}"
  message.delivery_info[:channel].reject message.delivery_info[:delivery_tag], false
end