Class: Basquiat::Adapters::RabbitMq::BaseStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ BaseStrategy

Returns a new instance of BaseStrategy.



17
18
19
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 17

def initialize(session)
  @session = session
end

Class Method Details

.session_optionsObject



8
9
10
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 8

def session_options
  {}
end

.setup(options = {}) ⇒ Object



12
13
14
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 12

def setup(options = {})
  @options = options
end

Instance Method Details

#ack(message) ⇒ Object



25
26
27
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 25

def ack(message)
  @session.channel.ack(message.delivery_tag)
end

#nack(message) ⇒ Object



29
30
31
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 29

def nack(message)
  @session.channel.nack(message.delivery_tag, false)
end

#requeue(message) ⇒ Object



33
34
35
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 33

def requeue(message)
  @session.channel.nack(message.delivery_tag, false, true)
end

#run(_message) ⇒ Object



21
22
23
# File 'lib/basquiat/adapters/rabbitmq/requeue_strategies/base_strategy.rb', line 21

def run(_message)
  raise Basquiat::Errors::SubclassResponsibility
end