Class: AceMQ::AMQP::Patterns::StreamRetention

Inherits:
Struct
  • Object
show all
Defined in:
lib/acemq/amqp/patterns/streams.rb

Overview

How much of a stream to keep.

Unbounded by default, which for a stream means "until the disk is full". Set at least one of these on anything that will run for long — a queue forgets what it delivers and a stream does not, so the mistake this prevents is one an ordinary queue cannot make.

segment_bytes is how large each file on disk gets. Retention happens a segment at a time, so a very large segment means retention is coarse: nothing is discarded until a whole segment can be.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#max_age ⇒ Object

Returns the value of attribute max_age

Returns:

  • (Object) —

    the current value of max_age



83
84
85
# File 'lib/acemq/amqp/patterns/streams.rb', line 83

def max_age
  @max_age
end

#max_bytes ⇒ Object

Returns the value of attribute max_bytes

Returns:

  • (Object) —

    the current value of max_bytes



83
84
85
# File 'lib/acemq/amqp/patterns/streams.rb', line 83

def max_bytes
  @max_bytes
end

#segment_bytes ⇒ Object

Returns the value of attribute segment_bytes

Returns:

  • (Object) —

    the current value of segment_bytes



83
84
85
# File 'lib/acemq/amqp/patterns/streams.rb', line 83

def segment_bytes
  @segment_bytes
end

Instance Method Details

#to_arguments ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
88
89
90
91
# File 'lib/acemq/amqp/patterns/streams.rb', line 85

def to_arguments
  arguments = { "x-queue-type" => "stream" }
  arguments["x-max-age"] = Patterns.duration_argument(max_age) if max_age
  arguments["x-max-length-bytes"] = max_bytes if max_bytes
  arguments["x-stream-max-segment-size-bytes"] = segment_bytes if segment_bytes
  arguments
end