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
Returns a new instance of Delivery.
5 6 7 8 9 10 |
# File 'lib/freddy/delivery.rb', line 5 def initialize(payload, , routing_key, tag) @payload = payload @metadata = @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 |
# File 'lib/freddy/delivery.rb', line 24 def build_trace(operation_name, tags: {}, force_follows_from: false) carrier = TraceCarrier.new(@metadata) parent = if expecting_response? && !force_follows_from OpenTracing.global_tracer.extract(OpenTracing::FORMAT_TEXT_MAP, carrier) else nil end # Creating a child span when the message sender is expecting a response. # Otherwise creating a new trace because the OpenTracing client does not # support FollowsFrom yet. OpenTracing.start_span(operation_name, child_of: parent, tags: ) end |
#correlation_id ⇒ Object
12 13 14 |
# File 'lib/freddy/delivery.rb', line 12 def correlation_id @metadata.correlation_id end |
#reply_to ⇒ Object
20 21 22 |
# File 'lib/freddy/delivery.rb', line 20 def reply_to @metadata.reply_to end |
#type ⇒ Object
16 17 18 |
# File 'lib/freddy/delivery.rb', line 16 def type @metadata.type end |