NATS.Client.JetStream
Consumer info object as retrieved from NATS JetStream server at the time this object was created, updated or refreshed.
Starts an enumerator consuming messages from the stream using this consumer.
Serializer to use for the message type.
Consume options. (default: MaxMsgs 1,000)
A used to cancel the call.
Message type to deserialize.
Async enumerable of messages which can be used in a await foreach loop.
Consumer is deleted, it's push based or request sent to server is invalid.
Consume a single message from the stream using this consumer.
Serializer to use for the message type.
Next message options. (default: 30 seconds timeout)
A used to cancel the call.
Message type to deserialize.
Message retrieved from the stream or NULL
Consumer is deleted, it's push based or request sent to server is invalid.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
If the request to server expires (in 30 seconds by default) this call returns NULL.
This method is implemented as a fetch with MaxMsgs=1 which means every request will create a new subscription
on the NATS server. This would be inefficient if you're consuming a lot of messages and you should consider using
fetch or consume methods.
The following example shows how you might process messages:
var next = await consumer.NextAsync<Data>();
if (next is { } msg)
{
// process the message
await msg.AckAsync();
}
Consume a set number of messages from the stream using this consumer.
Serializer to use for the message type.
Fetch options. (default: MaxMsgs 1,000 and timeout in 30 seconds)
A used to cancel the call.
Message type to deserialize.
Async enumerable of messages which can be used in a await foreach loop.
Consumer is deleted, it's push based or request sent to server is invalid.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
Retrieve the consumer info from the server and update this consumer.
A used to cancel the API call.
There was an issue retrieving the response.
Server responded with an error.
Creates new ordered consumer.
Stream name to create the consumer under.
Ordered consumer options.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving ordered data from the stream.
Creates new consumer if it doesn't exists or returns an existing one with the same name.
Name of the stream to create consumer under.
Consumer configuration.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
Ack policy is set to none or there was an issue retrieving the response.
Server responded with an error.
Gets consumer information from the server and creates a NATS JetStream consumer .
Stream name where consumer is associated to.
Consumer name.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
There was an issue retrieving the response.
Server responded with an error.
Enumerates through consumers belonging to a stream.
Stream name the consumers belong to.
A used to cancel the API call.
Async enumerable of consumer info objects. Can be used in a await foreach loop.
There was an issue retrieving the response.
Server responded with an error.
Enumerates through consumer names belonging to a stream.
Stream name the consumers belong to.
A used to cancel the API call.
Async enumerable of consumer info objects. Can be used in a await foreach loop.
There was an issue retrieving the response.
Server responded with an error.
Delete a consumer from a stream.
Stream name where consumer is associated to.
Consumer name to be deleted.
A used to cancel the API call.
Whether the deletion was successful.
There was an issue retrieving the response.
Server responded with an error.
Calls JetStream Account Info API.
A used to cancel the API call.
The account information based on the NATS connection credentials.
Sends data to a stream associated with the subject.
Subject to publish the data to.
Data to publish.
Serializer to use for the message type.
Publish options.
Optional message headers.
A used to cancel the publishing call or the wait for response.
Type of the data being sent.
The ACK response to indicate if stream accepted the message as well as additional
information like the sequence number of the message stored by the stream.
There was a problem receiving the response.
Note that if the subject isn't backed by a stream or the connected NATS server
isn't running with JetStream enabled, this call will hang waiting for an ACK
until the request times out.
Creates a new stream if it doesn't exist or returns an existing stream with the same name.
Stream configuration request to be sent to NATS JetStream server.
A used to cancel the API call.
The NATS JetStream stream object which can be used to manage the stream.
There was an issue retrieving the response.
Server responded with an error.
Deletes a stream.
Stream name to be deleted.
A used to cancel the API call.
Whether delete was successful or not.
There was an issue retrieving the response.
Server responded with an error.
Purges all of the (or filtered) data in a stream, leaves the stream.
Stream name to be purged.
Purge request.
A used to cancel the API call.
Purge response
There was an issue retrieving the response.
Server responded with an error.
Deletes a message from a stream.
Stream name to delete message from.
Delete message request.
A used to cancel the API call.
Delete message response
There was an issue retrieving the response.
Server responded with an error.
Get stream information from the server and creates a NATS JetStream stream object .
Name of the stream to retrieve.
Stream info request options
A used to cancel the API call.
The NATS JetStream stream object which can be used to manage the stream.
There was an issue retrieving the response.
Server responded with an error.
Update a NATS JetStream stream's properties.
Stream update request object to be sent to NATS JetStream server.
A used to cancel the API call.
The updated NATS JetStream stream object.
There was an issue retrieving the response.
Server responded with an error.
Enumerates through the streams exists on the NATS JetStream server.
Limit the list to streams matching this subject filter.
A used to cancel the API call.
Async enumerable of stream objects. Can be used in a await foreach loop.
There was an issue retrieving the response.
Server responded with an error.
Stream info object as retrieved from NATS JetStream server at the time this object was created, updated or refreshed.
Delete this stream.
A used to cancel the API call.
Whether delete was successful or not.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
After deletion this object can't be used anymore.
Purge data from this stream. Leaves the stream.
Purge request.
A used to cancel the API call.
Whether delete was successful or not.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
After deletion this object can't be used anymore.
Deletes a message from a stream.
Delete message request.
A used to cancel the API call.
Delete message response
There was an issue retrieving the response.
Server responded with an error.
Update stream properties on the server.
Stream update request to be sent to the server.
A used to cancel the API call.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Creates new consumer for this stream if it doesn't exists or returns an existing one with the same name.
Consumer configuration.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
Ack policy is set to none or there is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Gets consumer information from the server and creates a NATS JetStream consumer .
Consumer name.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Enumerates through consumers belonging to this stream.
A used to cancel the API call.
Async enumerable of consumer objects. Can be used in a await foreach loop.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Enumerates through consumers names belonging to this stream.
A used to cancel the API call.
Async enumerable of consumer names. Can be used in a await foreach loop.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Delete a consumer from this stream.
Consumer name to be deleted.
A used to cancel the API call.
Whether the deletion was successful.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Retrieve the stream info from the server and update this stream.
A used to cancel the API call.
There was an issue retrieving the response.
Server responded with an error.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
Defines the source generated JSON serialization contract metadata for a given type.
The default associated with a default instance.
The source-generated options associated with this context.
Default watch options
Idle heartbeat interval
JetStream response including an optional error property encapsulating both successful and failed calls.
JetStream response type
A response from the JetStream $JS.API.INFO API
The maximum amount of Memory storage Stream Messages may consume
The maximum amount of File storage Stream Messages may consume
The maximum number of Streams an account can create
The maximum number of Consumer an account can create
Indicates if Streams created in this account requires the max_bytes property set
The maximum number of outstanding ACKs any consumer may configure
The maximum size any single memory stream may be
The maximum size any single storage based stream may be
A response from the JetStream $JS.API.ACCOUNT.PURGE API
If the purge operation was succesfully started
Memory Storage being used for Stream Message storage
File Storage being used for Stream Message storage
Number of active Streams
Number of active Consumers
The JetStream domain this account is in
HTTP like error code in the 300 to 500 range
A human friendly description of the error
The NATS error code unique to each kind of error
Total number of API requests received for this account
API requests that resulted in an error response
The cluster name
The server name of the RAFT leader
The members of the RAFT cluster
A unique name for a durable consumer
A unique name for a consumer
A short description of the purpose of this consumer
How long (in nanoseconds) to allow messages to remain un-acknowledged before attempting redelivery
The number of times a message will be redelivered to consumers if not acknowledged in time
Filter the stream by a single subjects
Filter the stream by multiple subjects
The rate at which messages will be delivered to clients, expressed in bit per second
The maximum number of messages without acknowledgement that can be outstanding, once this limit is reached message delivery will be suspended
If the Consumer is idle for more than this many nano seconds a empty message with Status header 100 will be sent indicating the consumer is still alive
For push consumers this will regularly send an empty mess with Status header 100 and a reply subject, consumers must reply to these messages to control the rate of message delivery
The number of pulls that can be outstanding on a pull consumer, pulls received after this is reached are ignored
Creates a special consumer that does not touch the Raft layers, not for general use by clients, internal use only
Delivers only the headers of messages in the stream and not the bodies. Additionally adds Nats-Msg-Size header to indicate the size of the removed payload
The largest batch property that may be specified when doing a pull on a Pull Consumer
The maximum expires value that may be set when doing a pull on a Pull Consumer
The maximum bytes value that maybe set when dong a pull on a Pull Consumer
Duration that instructs the server to cleanup ephemeral consumers that are inactive for that long
List of durations in Go format that represents a retry time scale for NaK'd messages
When set do not inherit the replica count from the stream but specifically set it to this amount
Force the consumer state to be kept in memory rather than inherit the setting from the stream
Additional metadata for the Consumer
A request to the JetStream $JS.API.CONSUMER.CREATE and $JS.API.CONSUMER.DURABLE.CREATE APIs
The name of the stream to create the consumer in
The consumer configuration
A response from the JetStream $JS.API.CONSUMER.CREATE API
A response from the JetStream $JS.API.CONSUMER.DELETE API
A request to the JetStream $JS.API.CONSUMER.MSG.NEXT API
A duration from now when the pull should expire, stated in nanoseconds, 0 for no expiry
How many messages the server should deliver to the requestor
Sends at most this many bytes to the requestor, limited by consumer configuration max_bytes
When true a response with a 404 status header will be returned when no messages are available
When not 0 idle heartbeats will be sent on this interval
The Stream the consumer belongs to
A unique name for the consumer, either machine generated or the durable name
The server time the consumer info was created
The time the Consumer was created
The last message delivered from this Consumer
The highest contiguous acknowledged message
The number of messages pending acknowledgement
The number of redeliveries that have been performed
The number of pull consumers waiting for messages
The number of messages left unconsumed in this Consumer
Indicates if any client is connected and receiving messages from a push consumer
A response from the JetStream $JS.API.CONSUMER.INFO API
A response from the JetStream $JS.API.CONSUMER.LEADER.STEPDOWN API
If the leader successfully stood down
A request to the JetStream $JS.API.CONSUMER.LIST API
A response from the JetStream $JS.API.CONSUMER.LIST API
Full Consumer information for each known Consumer
A request to the JetStream $JS.API.CONSUMER.NAMES API
Filter the names to those consuming messages matching this subject or wildcard
A response from the JetStream $JS.API.CONSUMER.NAMES API
Configuration referencing a stream source in another account or JetStream domain
The subject prefix that imports the other account/domain $JS.API.CONSUMER.> subjects
The delivery subject to use for the push consumer
Records messages that were damaged and unrecoverable
The messages that were lost
The number of bytes that were lost
A request to the JetStream $JS.API.META.LEADER.STEPDOWN API
A response from the JetStream $JS.API.META.LEADER.STEPDOWN API
If the leader successfully stood down
A request to the JetStream $JS.API.SERVER.REMOVE API
The Name of the server to remove from the meta group
Peer ID of the peer to be removed. If specified this is used instead of the server name
A response from the JetStream $JS.API.SERVER.REMOVE API
If the peer was successfully removed
The server name of the peer
Indicates if the server is up to date and synchronised
Nanoseconds since this peer was last seen
Indicates the node is considered offline by the group
How many uncommitted operations this peer is behind the leader
Placement requirements for a stream
The desired cluster name to place the stream
Tags required on servers hosting this stream
A response received when publishing a message
The name of the stream that received the message
If successful this will be the sequence the message is stored at
Indicates that the message was not stored due to the Nats-Msg-Id header and duplicate tracking
If the Stream accepting the message is in a JetStream server configured for a domain this would be that domain
Rules for republishing messages from a stream with subject mapping onto new subjects for partitioning and more
The source subject to republish
The destination to publish to
Only send message headers, no bodies
The sequence number of the Consumer
The sequence number of the Stream
The last time a message was delivered or acknowledged (for ack_floor)
The sequence number of the Consumer
The sequence number of the Stream
The subject the message was originally received on
The sequence number of the message in the Stream
The base64 encoded payload of the message body
The time the message was received
Base64 encoded headers for the message
An alternate location to read mirrored data
The mirror stream name
The name of the cluster holding the stream
The domain holding the string
A unique name for the Stream, empty for Stream Templates.
A short description of the purpose of this stream
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 to apply to matching messages
How messages are retained in the Stream, once this is exceeded old messages are removed.
How many Consumers can be defined for a given Stream. -1 for unlimited.
How many messages may be in a Stream, oldest messages will be removed if the Stream exceeds this size. -1 for unlimited.
For wildcard streams ensure that for every unique subject this many messages are kept - a per subject retention limit
How big the Stream may be, when the combined stream size exceeds this old messages are removed. -1 for unlimited.
Maximum age of any message in the stream, expressed in nanoseconds. 0 for unlimited.
The largest message that will be accepted by the Stream. -1 for unlimited.
The storage backend to use for the Stream.
Optional compression algorithm used for the Stream.
How many replicas to keep for each message.
Disables acknowledging messages that are received by the Stream.
When the Stream is managed by a Stream Template this identifies the template that manages the Stream.
When a Stream reach it's limits either old messages are deleted or new ones are denied
The time window to track duplicate messages for, expressed in nanoseconds. 0 for default
Placement directives to consider when placing replicas of this stream, random placement when unset
Maintains a 1:1 mirror of another stream with name matching this property. When a mirror is configured subjects and sources must be empty.
List of Stream names to replicate into this Stream
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
Restricts the ability to delete messages from a stream via the API. Cannot be changed once set to true
Restricts the ability to purge messages from a stream via the API. Cannot be change once set to true
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 higher performance, direct access to get individual messages
Allow higher performance, direct access for mirrors as well
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.
Additional metadata for the Stream
A response from the JetStream $JS.API.STREAM.CREATE API
A response from the JetStream $JS.API.STREAM.DELETE API
The active configuration for the Stream
Detail about the current State of the Stream
Timestamp when the stream was created
The server time the stream info was created
Streams being sourced into this Stream
List of mirrors sorted by priority
A request to the JetStream $JS.API.STREAM.INFO API
When true will result in a full list of deleted message IDs being returned in the info response
When set will return a list of subjects and how many messages they hold for all matching subjects. Filter is a standard NATS subject wildcard pattern.
Paging offset when retrieving pages of subjet details
A response from the JetStream $JS.API.STREAM.INFO API
A response from the JetStream $JS.API.STREAM.LEADER.STEPDOWN API
If the leader successfully stood down
A request to the JetStream $JS.API.STREAM.LIST API
Limit the list to streams matching this subject filter
A response from the JetStream $JS.API.STREAM.LIST API
Full Stream information for each known Stream
In clustered environments gathering Stream info might time out, this list would be a list of Streams for which information was not obtainable
A request to the JetStream $JS.API.STREAM.MSG.DELETE API
Stream sequence number of the message to delete
Default will securely remove a message and rewrite the data with random data, set this to true to only remove the message
A response from the JetStream $JS.API.STREAM.MSG.DELETE API
A request to the JetStream $JS.API.STREAM.MSG.GET API
Stream sequence number of the message to retrieve, cannot be combined with last_by_subj
Retrieves the last message for a given subject, cannot be combined with seq
Combined with sequence gets the next message for a subject with the given sequence or higher
A response from the JetStream $JS.API.STREAM.MSG.GET API
A request to the JetStream $JS.API.STREAM.NAMES API
Limit the list to streams matching this subject filter
A response from the JetStream $JS.API.STREAM.NAMES API
A request to the JetStream $JS.API.STREAM.PURGE API
Restrict purging to messages that match this subject
Purge all messages up to but not including the message with this sequence. Can be combined with subject filter but not the keep option
Ensures this many messages are present after the purge. Can be combined with the subject filter but not the sequence
A response from the JetStream $JS.API.STREAM.PURGE API
Number of messages purged from the Stream
A request to the JetStream $JS.API.STREAM.PEER.REMOVE API
Server name of the peer to remove
A response from the JetStream $JS.API.STREAM.PEER.REMOVE API
If the peer was successfully removed
A response from the JetStream $JS.API.STREAM.RESTORE API
A response from the JetStream $JS.API.STREAM.RESTORE API
The Subject to send restore chunks to
A request to the JetStream $JS.API.STREAM.SNAPSHOT API
The NATS subject where the snapshot will be delivered
When true consumer states and configurations will not be present in the snapshot
The size of data chunks to send to deliver_subject
Check all message's checksums prior to snapshot
A response from the JetStream $JS.API.STREAM.SNAPSHOT API
Defines a source where streams should be replicated from
Stream name
Sequence to start replicating from
Time stamp to start replicating from
Replicate only a subset of messages based on filter
Subject transforms to apply to matching messages
Information about an upstream stream source in a mirror
The name of the Stream being replicated
The subject filter to apply to the messages
The subject transform destination to apply to the messages
How many messages behind the mirror operation is
When last the mirror had activity, in nanoseconds. Value will be -1 when there has been no activity.
Number of messages stored in the Stream
Combined size of all messages in the Stream
Sequence number of the first message in the Stream
The timestamp of the first message in the Stream
Sequence number of the last message in the Stream
The timestamp of the last message in the Stream
IDs of messages that were deleted using the Message Delete API or Interest based streams removing messages out of order
Subjects and their message counts when a subjects_filter was set
The number of unique subjects held in the stream
The number of deleted messages
Number of Consumers attached to the Stream
The data structure that describe the configuration of a NATS JetStream Stream Template
A unique name for the Stream Template.
The maximum number of Streams this Template can create, -1 for unlimited.
A request to the JetStream $JS.API.STREAM.TEMPLATE.CREATE API
A response from the JetStream $JS.API.STREAM.TEMPLATE.CREATE API
A response from the JetStream $JS.API.STREAM.TEMPLATE.DELETE API
List of Streams managed by this Template
A response from the JetStream $JS.API.STREAM.TEMPLATE.INFO API
A request to the JetStream $JS.API.CONSUMER.LIST API
A response from the JetStream $JS.API.STREAM.TEMPLATE.NAMES API
A request to the JetStream $JS.API.STREAM.UPDATE API
A response from the JetStream $JS.API.STREAM.UPDATE API
Subject transform to apply to matching messages going into the stream
The subject transform source
The subject transform destination
Memory Storage being used for Stream Message storage
File Storage being used for Stream Message storage
Number of active Streams
Number of active Consumers
Represents a NATS JetStream consumer.
Consumer info object as retrieved from NATS JetStream server at the time this object was created, updated or refreshed.
Delete this consumer.
A used to cancel the API call.
Whether delete was successful or not.
There was an issue retrieving the response.
Server responded with an error.
After deletion this object can't be used anymore.
Server responded with an error.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
Starts an enumerator consuming messages from the stream using this consumer.
Serializer to use for the message type.
Consume options. (default: MaxMsgs 1,000)
A used to cancel the call.
Message type to deserialize.
Async enumerable of messages which can be used in a await foreach loop.
Consumer is deleted, it's push based or request sent to server is invalid.
Consume a single message from the stream using this consumer.
Serializer to use for the message type.
Next message options. (default: 30 seconds timeout)
A used to cancel the call.
Message type to deserialize.
Message retrieved from the stream or NULL
Consumer is deleted, it's push based or request sent to server is invalid.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
If the request to server expires (in 30 seconds by default) this call returns NULL.
This method is implemented as a fetch with MaxMsgs=1 which means every request will create a new subscription
on the NATS server. This would be inefficient if you're consuming a lot of messages and you should consider using
fetch or consume methods.
The following example shows how you might process messages:
var next = await consumer.NextAsync<Data>();
if (next is { } msg)
{
// process the message
await msg.AckAsync();
}
Consume a set number of messages from the stream using this consumer.
Serializer to use for the message type.
Fetch options. (default: MaxMsgs 1,000 and timeout in 30 seconds)
A used to cancel the call.
Message type to deserialize.
Async enumerable of messages which can be used in a await foreach loop.
Consumer is deleted, it's push based or request sent to server is invalid.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
Consume a set number of messages from the stream using this consumer.
Returns immediately if no messages are available.
Serializer to use for the message type.
Fetch options. (default: MaxMsgs 1,000 and timeout is ignored)
A used to cancel the call.
Message type to deserialize.
Async enumerable of messages which can be used in a await foreach loop.
Consumer is deleted, it's push based or request sent to server is invalid.
There is an error sending the message or this consumer object isn't valid anymore because it was deleted earlier.
This method will return immediately if no messages are available.
Using this method is discouraged because it might create an unnecessary load on your cluster.
Use Consume or Fetch instead.
However, there are scenarios where this method is useful. For example if your application is
processing messages in batches infrequently (for example every 5 minutes) you might want to
consider FetchNoWait. You must make sure to count your messages and stop fetching
if you received all of them in one call, meaning when count < MaxMsgs.
const int max = 10;
var count = 0;
await foreach (var msg in consumer.FetchAllNoWaitAsync<int>(new NatsJSFetchOpts { MaxMsgs = max }))
{
count++;
Process(msg);
await msg.AckAsync();
}
if (count < max)
{
// No more messages. Pause for more.
await Task.Delay(TimeSpan.FromMinutes(5));
}
Retrieve the consumer info from the server and update this consumer.
A used to cancel the API call.
There was an issue retrieving the response.
Server responded with an error.
Provides management and access to NATS JetStream streams and consumers.
Creates new ordered consumer.
Stream name to create the consumer under.
Ordered consumer options.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving ordered data from the stream.
>
Gets consumer information from the server and creates a NATS JetStream consumer .
Stream name where consumer is associated to.
Consumer name.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
There was an issue retrieving the response.
Server responded with an error.
Delete a consumer from a stream.
Stream name where consumer is associated to.
Consumer name to be deleted.
A used to cancel the API call.
Whether the deletion was successful.
There was an issue retrieving the response.
Server responded with an error.
>
Creates a NATS JetStream context used to manage and access streams and consumers.
A NATS server connection to access the JetStream APIs, publishers and consumers.
Context wide JetStream options.
Calls JetStream Account Info API.
A used to cancel the API call.
The account information based on the NATS connection credentials.
Sends data to a stream associated with the subject.
Subject to publish the data to.
Data to publish.
Serializer to use for the message type.
Publish options.
Optional message headers.
A used to cancel the publishing call or the wait for response.
Type of the data being sent.
The ACK response to indicate if stream accepted the message as well as additional
information like the sequence number of the message stored by the stream.
There was a problem receiving the response.
Note that if the subject isn't backed by a stream or the connected NATS server
isn't running with JetStream enabled, this call will hang waiting for an ACK
until the request times out.
By setting msgId you can ensure messages written to a stream only once. JetStream support idempotent
message writes by ignoring duplicate messages as indicated by the Nats-Msg-Id header. If both msgId
and the Nats-Msg-Id header value was set, msgId parameter value will be used.
Creates a new stream if it doesn't exist or returns an existing stream with the same name.
Stream configuration request to be sent to NATS JetStream server.
A used to cancel the API call.
The NATS JetStream stream object which can be used to manage the stream.
There was an issue retrieving the response.
Server responded with an error.
Deletes a stream.
Stream name to be deleted.
A used to cancel the API call.
Whether delete was successful or not.
There was an issue retrieving the response.
Server responded with an error.
Purges all of the (or filtered) data in a stream, leaves the stream.
Stream name to be purged.
Purge request.
A used to cancel the API call.
Purge response
There was an issue retrieving the response.
Server responded with an error.
Deletes a message from a stream.
Stream name to delete message from.
Delete message request.
A used to cancel the API call.
Delete message response
There was an issue retrieving the response.
Server responded with an error.
Get stream information from the server and creates a NATS JetStream stream object .
Name of the stream to retrieve.
Stream info request options
A used to cancel the API call.
The NATS JetStream stream object which can be used to manage the stream.
There was an issue retrieving the response.
Server responded with an error.
Update a NATS JetStream stream's properties.
Stream update request object to be sent to NATS JetStream server.
A used to cancel the API call.
The updated NATS JetStream stream object.
There was an issue retrieving the response.
Server responded with an error.
Enumerates through the streams exists on the NATS JetStream server.
Limit the list to streams matching this subject filter.
A used to cancel the API call.
Async enumerable of stream objects. Can be used in a await foreach loop.
There was an issue retrieving the response.
Server responded with an error.
List stream names.
Limit the list to streams matching this subject filter.
A used to cancel the API call.
Async enumerable list of stream names to be used in a await foreach loop.
Generic JetStream exception.
Create JetStream generic exception.
Error message.
Create JetStream generic exception.
Error message.
Inner exception.
JetStream protocol errors received during message consumption.
Create JetStream protocol exception.
Server error code
Server error message enum (if defined)
Server error message string
The exception that is thrown when JetStream publish acknowledgment indicates a duplicate sequence error.
Create JetStream duplicate message exception.
The duplicate sequence number.
The duplicate sequence number.
JetStream API call errors.
Create JetStream API exception.
Error response received from the server.
API error response received from the server.
Make sure acknowledgment was successful and throw an exception otherwise.
ACK response.
is NULL.
Server responded with an error.
A message with the same Nats-Msg-Id was received before.
NATS JetStream message with and control messages.
User message type
Subject of the user message.
Message size in bytes.
Message size is calculated using the same method NATS server uses:
int size = subject.Length + replyTo.Length + headers.Length + payload.Length;
Headers of the user message if set.
Deserialized user data.
The connection messages was delivered on.
Additional metadata about the message.
Reply with an empty message.
Optional message headers.
Optional reply-to subject.
A for publishing options.
A used to cancel the command.
A that represents the asynchronous send operation.
Acknowledges the message was completely handled.
Ack options.
A used to cancel the call.
A representing the async call.
Signals that the message will not be processed now and processing can move onto the next message.
Delay redelivery of the message.
Ack options.
A used to cancel the call.
A representing the async call.
Messages rejected using -NAK will be resent by the NATS JetStream server after the configured timeout
or the delay parameter if it's specified.
Indicates that work is ongoing and the wait period should be extended.
Ack options.
A used to cancel the call.
A representing the async call.
Time period is defined by the consumer's ack_wait configuration on the server which is
defined as how long to allow messages to remain un-acknowledged before attempting redelivery.
This message must be sent before the ack_wait period elapses. The period should be extended
by another amount of time equal to ack_wait by the NATS JetStream server.
Instructs the server to stop redelivery of the message without acknowledging it as successfully processed.
Ack options.
A used to cancel the call.
A representing the async call.
Options to be used when acknowledging messages received from a stream using a consumer.
Wait for the publish to be flushed down to the network.
Ask server for an acknowledgment.
Options to be used when acknowledging messages received from a stream using a consumer.
Wait for the publish to be flushed down to the network.
Ask server for an acknowledgment.
Wait for the publish to be flushed down to the network.
Ask server for an acknowledgment.
Additional metadata about the message.
The sequence pair for the message.
The number of times the message was delivered.
The number of messages pending for the consumer.
The timestamp of the message.
The stream the message was sent to.
The consumer the message was sent to.
The domain the message was sent to.
Additional metadata about the message.
The sequence pair for the message.
The number of times the message was delivered.
The number of messages pending for the consumer.
The timestamp of the message.
The stream the message was sent to.
The consumer the message was sent to.
The domain the message was sent to.
The sequence pair for the message.
The number of times the message was delivered.
The number of messages pending for the consumer.
The timestamp of the message.
The stream the message was sent to.
The consumer the message was sent to.
The domain the message was sent to.
The sequence pair for the message.
The stream sequence number.
The consumer sequence number.
The sequence pair for the message.
The stream sequence number.
The consumer sequence number.
The stream sequence number.
The consumer sequence number.
JetStream options to be used within a JetStream context.
Complete prefix to prepend to JetStream API subjects as it's dynamically built from ApiPrefix and Domain properties.
Prefix to prepend to JetStream API subjects. (default: $JS.API)
JetStream domain to use in JetStream API subjects. (default: null)
Message ACK options .
These options are used as the defaults when acknowledging messages received from a stream using a consumer.
Default consume options to be used in consume calls in this context.
Defaults to MaxMsgs = 1,000.
Default fetch options to be used in fetch calls in this context.
Defaults to MaxMsgs = 1,000.
Default next options to be used in next calls in this context.
Maximum number of attempts for the consumer to be recreated (Defaults to unlimited).
Consumer consume method options.
Maximum number of messages stored in the buffer
Amount of time to wait for a single pull request to expire
Maximum number of bytes stored in the buffer
Amount idle time the server should wait before sending a heartbeat
Number of messages left in the buffer that should trigger a low watermark on the client, and influence it to request more messages
Hint for the number of bytes left in buffer that should trigger a low watermark on the client, and influence it to request more data.
Consumer next method options.
Amount of time to wait for the request to expire (in nanoseconds)
Amount idle time the server should wait before sending a heartbeat. For requests with expires > 30s, heartbeats should be enabled by default
Consumer fetch method options.
Maximum number of messages to return
Amount of time to wait for the request to expire
Maximum number of bytes to return
Amount idle time the server should wait before sending a heartbeat. For requests with expires > 30s, heartbeats should be enabled by default
Does not wait for messages to be available
NATS JetStream ordered consumer.
Creates a new NATS JetStream ordered consumer.
Name of the stream.
NATS JetStream context.
Consumer options.
A used to cancel consume and fetch operations.
Consumer info object created during consume and fetch operations.
Consume messages from the stream in order.
Serializer to use for the message type.
Consume options.
A used to cancel consume operation.
Serialized message data type.
Asynchronous enumeration which can be used in a await foreach loop.
There was a JetStream server error.
Fetch messages from the stream in order.
Serializer to use for the message type.
Fetch options.
A used to cancel fetch operation.
Serialized message data type.
Asynchronous enumeration which can be used in a await foreach loop.
Get the next message from the stream in order.
Serializer to use for the message type.
Next options.
A used to cancel the underlying fetch operation.
Serialized message data type.
The next NATS JetStream message in order.
For ordered consumer this is a no-op.
A used to cancel the API call.
Represents a NATS JetStream stream.
Stream info object as retrieved from NATS JetStream server at the time this object was created, updated or refreshed.
Delete this stream.
A used to cancel the API call.
Whether delete was successful or not.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
After deletion this object can't be used anymore.
Purge data from this stream. Leaves the stream.
Purge request.
A used to cancel the API call.
Whether delete was successful or not.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
After deletion this object can't be used anymore.
Deletes a message from a stream.
Delete message request.
A used to cancel the API call.
Delete message response
There was an issue retrieving the response.
Server responded with an error.
Update stream properties on the server.
Stream update request to be sent to the server.
A used to cancel the API call.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Creates new consumer for this stream if it doesn't exists or returns an existing one with the same name.
Consumer configuration.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
Ack policy is set to none or there is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Gets consumer information from the server and creates a NATS JetStream consumer .
Consumer name.
A used to cancel the API call.
The NATS JetStream consumer object which can be used retrieving data from the stream.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Enumerates through consumers that belong to this stream.
A used to cancel the API call.
Async enumerable of consumer objects. Can be used in a await foreach loop.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Enumerates through consumer names that belong to this stream.
A used to cancel the API call.
Async enumerable of consumer names. Can be used in a await foreach loop.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Delete a consumer from this stream.
Consumer name to be deleted.
A used to cancel the API call.
Whether the deletion was successful.
There is an error retrieving the response or this consumer object isn't valid anymore because it was deleted earlier.
Server responded with an error.
Retrieve the stream info from the server and update this stream.
A used to cancel the API call.
There was an issue retrieving the response.
Server responded with an error.