class Batsir::Notifiers::AMQPNotifier
Attributes
error_strategy[R]
Public Class Methods
new(options = {}, error_strategy = Batsir::Strategies::RetryStrategy)
click to toggle source
Calls superclass method
# File lib/batsir/notifiers/amqp_notifier.rb, line 10 def initialize(options = {}, error_strategy = Batsir::Strategies::RetryStrategy) super(options) @error_strategy = error_strategy.new(self) @bunny = Bunny.new(bunny_options).start @channel = @bunny.create_channel @queue = @channel.queue(queue, durable: durable) end
Public Instance Methods
execute(message)
click to toggle source
# File lib/batsir/notifiers/amqp_notifier.rb, line 18 def execute(message) @queue.publish(message, :routing_key => queue) end
handle_error(message, error)
click to toggle source
# File lib/batsir/notifiers/amqp_notifier.rb, line 22 def handle_error(message, error) @error_strategy.execute(message, error) end