Class: JetstreamBridge::MessageContext
- Inherits:
-
Struct
- Object
- Struct
- JetstreamBridge::MessageContext
- Defined in:
- lib/jetstream_bridge/consumer/message_processor.rb
Overview
Immutable per-message metadata.
Instance Attribute Summary collapse
-
#consumer ⇒ Object
Returns the value of attribute consumer.
-
#deliveries ⇒ Object
Returns the value of attribute deliveries.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#seq ⇒ Object
Returns the value of attribute seq.
-
#stream ⇒ Object
Returns the value of attribute stream.
-
#subject ⇒ Object
Returns the value of attribute subject.
Class Method Summary collapse
Instance Attribute Details
#consumer ⇒ Object
Returns the value of attribute consumer
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def consumer @consumer end |
#deliveries ⇒ Object
Returns the value of attribute deliveries
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def deliveries @deliveries end |
#event_id ⇒ Object
Returns the value of attribute event_id
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def event_id @event_id end |
#seq ⇒ Object
Returns the value of attribute seq
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def seq @seq end |
#stream ⇒ Object
Returns the value of attribute stream
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def stream @stream end |
#subject ⇒ Object
Returns the value of attribute subject
12 13 14 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 12 def subject @subject end |
Class Method Details
.build(msg) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jetstream_bridge/consumer/message_processor.rb', line 16 def self.build(msg) new( event_id: msg.header&.[]('nats-msg-id') || SecureRandom.uuid, deliveries: msg.&.num_delivered.to_i, subject: msg.subject, seq: msg.&.sequence, consumer: msg.&.consumer, stream: msg.&.stream ) end |