class Atatus::Spies::SneakersSpy::Middleware

@api private

Public Class Methods

new(app, *args) click to toggle source
# File lib/atatus/spies/sneakers.rb, line 44
def initialize(app, *args)
  @app = app
  @args = args
end

Public Instance Methods

call(deserialized_msg, delivery_info, metadata, handler) click to toggle source
# File lib/atatus/spies/sneakers.rb, line 49
def call(deserialized_msg, delivery_info, metadata, handler)
  transaction =
    Atatus.start_transaction(
      delivery_info.consumer.queue.name,
      'Sneakers'
    )

  Atatus.set_label(:routing_key, delivery_info.routing_key)

  res = @app.call(deserialized_msg, delivery_info, metadata, handler)
  transaction&.done(:success)

  res
rescue ::Exception => e
  Atatus.report(e, handled: false)
  transaction&.done(:error)
  raise
ensure
  Atatus.end_transaction
end