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.



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

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.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def consumer
  @consumer
end

#domainObject (readonly)

Returns the value of attribute domain.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def domain
  @domain
end

#num_deliveredObject (readonly)

Returns the value of attribute num_delivered.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def num_delivered
  @num_delivered
end

#num_pendingObject (readonly)

Returns the value of attribute num_pending.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def num_pending
  @num_pending
end

#sequenceObject (readonly)

Returns the value of attribute sequence.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def sequence
  @sequence
end

#streamObject (readonly)

Returns the value of attribute stream.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def stream
  @stream
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



21
22
23
# File 'lib/nats/io/jetstream/msg/metadata.rb', line 21

def timestamp
  @timestamp
end