Class: Freddy::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/freddy/delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload, metadata, routing_key, tag) ⇒ Delivery



5
6
7
8
9
10
# File 'lib/freddy/delivery.rb', line 5

def initialize(payload, , routing_key, tag)
  @payload = payload
   = 
  @routing_key = routing_key
  @tag = tag
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



3
4
5
# File 'lib/freddy/delivery.rb', line 3

def payload
  @payload
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



3
4
5
# File 'lib/freddy/delivery.rb', line 3

def routing_key
  @routing_key
end

#tagObject (readonly)

Returns the value of attribute tag.



3
4
5
# File 'lib/freddy/delivery.rb', line 3

def tag
  @tag
end

Instance Method Details

#build_trace(operation_name, tags: {}, force_follows_from: false) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/freddy/delivery.rb', line 24

def build_trace(operation_name, tags: {}, force_follows_from: false)
  carrier = TraceCarrier.new()
  parent = OpenTracing.global_tracer.extract(OpenTracing::FORMAT_TEXT_MAP, carrier)

  references =
    if !parent
      []
    elsif force_follows_from
      [OpenTracing::Reference.follows_from(parent)]
    else
      [OpenTracing::Reference.child_of(parent)]
    end

  OpenTracing.start_active_span(operation_name, references: references, tags: tags)
end

#correlation_idObject



12
13
14
# File 'lib/freddy/delivery.rb', line 12

def correlation_id
  .correlation_id
end

#reply_toObject



20
21
22
# File 'lib/freddy/delivery.rb', line 20

def reply_to
  .reply_to
end

#typeObject



16
17
18
# File 'lib/freddy/delivery.rb', line 16

def type
  .type
end