Streams

NATS.JetStream.StreamConfigurationType

Configuration options for a stream.

  • name::String: A unique name for the Stream.

  • description::Union{Nothing, String}: A short description of the purpose of this stream

  • subjects::Union{Nothing, Vector{String}}: A list of subjects to consume, supports wildcards. Must be empty when a mirror is configured. May be empty when sources are configured.

  • subject_transform::Union{Nothing, NATS.JetStream.SubjectTransform}: Subject transform to apply to matching messages

  • retention::Symbol: How messages are retained in the Stream, once this is exceeded old messages are removed.

  • max_consumers::Int64: How many Consumers can be defined for a given Stream. -1 for unlimited.

  • max_msgs::Int64: How many messages may be in a Stream, oldest messages will be removed if the Stream exceeds this size. -1 for unlimited.

  • max_msgs_per_subject::Union{Nothing, Int64}: For wildcard streams ensure that for every unique subject this many messages are kept - a per subject retention limit

  • max_bytes::Int64: How big the Stream may be, when the combined stream size exceeds this old messages are removed. -1 for unlimited.

  • max_age::Int64: Maximum age of any message in the stream, expressed in nanoseconds. 0 for unlimited.

  • max_msg_size::Union{Nothing, Int32}: The largest message that will be accepted by the Stream. -1 for unlimited.

  • storage::Symbol: The storage backend to use for the Stream.

  • compression::Symbol: Optional compression algorithm used for the Stream.

  • first_seq::Union{Nothing, UInt64}: A custom sequence to use for the first message in the stream

  • num_replicas::Int64: How many replicas to keep for each message.

  • no_ack::Union{Nothing, Bool}: Disables acknowledging messages that are received by the Stream.

  • discard::Union{Nothing, Symbol}: When a Stream reach it's limits either old messages are deleted or new ones are denied

  • duplicate_window::Union{Nothing, Int64}: The time window to track duplicate messages for, expressed in nanoseconds. 0 for default

  • placement::Union{Nothing, NATS.JetStream.Placement}: Placement directives to consider when placing replicas of this stream, random placement when unset

  • mirror::Union{Nothing, StreamSource}: Maintains a 1:1 mirror of another stream with name matching this property. When a mirror is configured subjects and sources must be empty.

  • sources::Union{Nothing, Vector{StreamSource}}: List of Stream names to replicate into this Stream

  • sealed::Union{Nothing, Bool}: Sealed streams do not allow messages to be deleted via limits or API, sealed streams can not be unsealed via configuration update. Can only be set on already created streams via the Update API

  • deny_delete::Union{Nothing, Bool}: Restricts the ability to delete messages from a stream via the API. Cannot be changed once set to true

  • deny_purge::Union{Nothing, Bool}: Restricts the ability to purge messages from a stream via the API. Cannot be change once set to true

  • allow_rollup_hdrs::Union{Nothing, Bool}: Allows the use of the Nats-Rollup header to replace all contents of a stream, or subject in a stream, with a single new message

  • allow_direct::Union{Nothing, Bool}: Allow higher performance, direct access to get individual messages

  • mirror_direct::Union{Nothing, Bool}: Allow higher performance, direct access for mirrors as well

  • republish::Union{Nothing, Republish}

  • discard_new_per_subject::Union{Nothing, Bool}: When discard policy is new and the stream is one with max messages per subject set, this will apply the new behavior to every subject. Essentially turning discard new from maximum number of subjects into maximum number of messages in a subject.

  • metadata::Union{Nothing, Dict{String, String}}: Additional metadata for the Stream

  • consumer_limits::Union{Nothing, StreamConsumerLimit}: Limits of certain values that consumers can set, defaults for those who don't set these settings

source

Management

Subscriptions

Messages

NATS.JetStream.stream_message_getFunction
stream_message_get(
    connection,
    stream_name,
    subject;
    allow_direct
)

Get a message from stream.

source
stream_message_get(connection, stream, subject)

Get a message from stream.

source