Module: Instana::Instrumentation::BunnyConsumer

Defined in:
lib/instana/instrumentation/bunny.rb

Instance Method Summary collapse

Instance Method Details

#pop(options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/instana/instrumentation/bunny.rb', line 39

def pop(options = {})
  delivery_info, properties, payload = super(options)

  return [delivery_info, properties, payload] unless delivery_info

  trace_rabbitmq_consume(delivery_info, properties) do
    [delivery_info, properties, payload]
  end
rescue => e
  log_error(e)
  raise
end

#subscribe(options = {}, &block) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/instana/instrumentation/bunny.rb', line 52

def subscribe(options = {}, &block)
  if block_given?
    wrapped_block = lambda do |delivery_info, properties, payload|
      trace_rabbitmq_consume(delivery_info, properties) do
        block.call(delivery_info, properties, payload)
      end
    end

    super(options, &wrapped_block)
  else
    super(options, &block)
  end
rescue => e
  log_error(e)
  raise
end