Class: JetstreamBridge::TestHelpers::MockNats::MockMessage
- Inherits:
-
Object
- Object
- JetstreamBridge::TestHelpers::MockNats::MockMessage
- Defined in:
- lib/jetstream_bridge/test_helpers/mock_nats.rb
Instance Attribute Summary collapse
-
#consumer ⇒ Object
readonly
Returns the value of attribute consumer.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#num_delivered ⇒ Object
readonly
Returns the value of attribute num_delivered.
-
#sequence ⇒ Object
readonly
Returns the value of attribute sequence.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #ack ⇒ Object
-
#initialize(subject:, data:, header:, sequence:, stream:, consumer:, num_delivered:, storage:, message_ref:) ⇒ MockMessage
constructor
A new instance of MockMessage.
- #metadata ⇒ Object
- #nak(in_progress_duration: nil) ⇒ Object
- #term ⇒ Object
Constructor Details
#initialize(subject:, data:, header:, sequence:, stream:, consumer:, num_delivered:, storage:, message_ref:) ⇒ MockMessage
Returns a new instance of MockMessage.
375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 375 def initialize(subject:, data:, header:, sequence:, stream:, consumer:, num_delivered:, storage:, message_ref:) @subject = subject @data = data @header = header @sequence = sequence @stream = stream @consumer = consumer @num_delivered = num_delivered @storage = storage = end |
Instance Attribute Details
#consumer ⇒ Object (readonly)
Returns the value of attribute consumer.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def consumer @consumer end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def data @data end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def header @header end |
#num_delivered ⇒ Object (readonly)
Returns the value of attribute num_delivered.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def num_delivered @num_delivered end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def sequence @sequence end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def stream @stream end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
373 374 375 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 373 def subject @subject end |
Instance Method Details
#ack ⇒ Object
397 398 399 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 397 def ack @storage.() end |
#metadata ⇒ Object
387 388 389 390 391 392 393 394 395 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 387 def OpenStruct.new( sequence: OpenStruct.new(stream: @sequence, consumer: @sequence), num_delivered: @num_delivered, stream: @stream, consumer: @consumer, timestamp: Time.now ) end |
#nak(in_progress_duration: nil) ⇒ Object
401 402 403 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 401 def nak(in_progress_duration: nil) @storage.(, delay: in_progress_duration) end |
#term ⇒ Object
405 406 407 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 405 def term @storage.() end |