Class: Freddy::Delivery
- Inherits:
-
Object
- Object
- Freddy::Delivery
- Defined in:
- lib/freddy/delivery.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#routing_key ⇒ Object
readonly
Returns the value of attribute routing_key.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #build_trace(operation_name, tags: {}, force_follows_from: false) ⇒ Object
- #correlation_id ⇒ Object
-
#initialize(payload, metadata, routing_key, tag) ⇒ Delivery
constructor
A new instance of Delivery.
- #reply_to ⇒ Object
- #type ⇒ Object
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
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/freddy/delivery.rb', line 3 def payload @payload end |
#routing_key ⇒ Object (readonly)
Returns the value of attribute routing_key.
3 4 5 |
# File 'lib/freddy/delivery.rb', line 3 def routing_key @routing_key end |
#tag ⇒ Object (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: ) end |
#correlation_id ⇒ Object
12 13 14 |
# File 'lib/freddy/delivery.rb', line 12 def correlation_id .correlation_id end |
#reply_to ⇒ Object
20 21 22 |
# File 'lib/freddy/delivery.rb', line 20 def reply_to .reply_to end |
#type ⇒ Object
16 17 18 |
# File 'lib/freddy/delivery.rb', line 16 def type .type end |