Class: NATS::JetStream::API::RawStreamMsg

Inherits:
Struct
  • Object
show all
Defined in:
lib/nats/io/jetstream/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ RawStreamMsg

Returns a new instance of RawStreamMsg.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/nats/io/jetstream/api.rb', line 282

def initialize(opts)
  opts[:data] = Base64.decode64(opts[:data]) if opts[:data]
  if opts[:hdrs]
    header = Base64.decode64(opts[:hdrs])
    hdr = {}
    lines = header.lines
    lines.slice(1, header.size).each do |line|
      line.rstrip!
      next if line.empty?
      key, value = line.strip.split(/\s*:\s*/, 2)
      hdr[key] = value
    end
    opts[:headers] = hdr
  end

  # Filter out members not present.
  rem = opts.keys - members
  opts.delete_if { |k| rem.include?(k) }
  super(opts)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



281
282
283
# File 'lib/nats/io/jetstream/api.rb', line 281

def data
  @data
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



281
282
283
# File 'lib/nats/io/jetstream/api.rb', line 281

def headers
  @headers
end

#seqObject

Returns the value of attribute seq

Returns:

  • (Object)

    the current value of seq



281
282
283
# File 'lib/nats/io/jetstream/api.rb', line 281

def seq
  @seq
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



281
282
283
# File 'lib/nats/io/jetstream/api.rb', line 281

def subject
  @subject
end

Instance Method Details

#sequenceObject



303
304
305
# File 'lib/nats/io/jetstream/api.rb', line 303

def sequence
  self.seq
end