Class: NATS::JetStream::Msg::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/nats/io/jetstream/msg/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Metadata

Returns a new instance of Metadata.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 25

def initialize(opts)
  @sequence = Ack::SequencePair.new(opts[Ack::StreamSeq].to_i, opts[Ack::ConsumerSeq].to_i)
  @domain = opts[Ack::Domain]
  @num_delivered = opts[Ack::NumDelivered].to_i
  @num_pending = opts[Ack::NumPending].to_i
  @timestamp = Time.at((opts[Ack::Timestamp].to_i / 1_000_000_000.0))
  @stream = opts[Ack::Stream]
  @consumer = opts[Ack::Consumer]
  # TODO: Not exposed in Go client either right now.
  # account      = opts[Ack::AccHash]
end

Instance Attribute Details

#consumerObject (readonly)

Returns the value of attribute consumer.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def consumer
  @consumer
end

#domainObject (readonly)

Returns the value of attribute domain.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def domain
  @domain
end

#num_deliveredObject (readonly)

Returns the value of attribute num_delivered.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def num_delivered
  @num_delivered
end

#num_pendingObject (readonly)

Returns the value of attribute num_pending.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def num_pending
  @num_pending
end

#sequenceObject (readonly)

Returns the value of attribute sequence.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def sequence
  @sequence
end

#streamObject (readonly)

Returns the value of attribute stream.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def stream
  @stream
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



23
24
25
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 23

def timestamp
  @timestamp
end