NATS C Client with JetStream and Streaming support
3.9.1
The nats.io C Client, Supported by Synadia Communications Inc.
|
#include <nats.h>
Public Attributes | |
const char * | Stream |
If specified, the consumer will be bound to this stream name. More... | |
const char * | Consumer |
If specified, the subscription will be bound to an existing consumer from the Stream without attempting to create. More... | |
const char * | Queue |
Queue name for queue subscriptions. More... | |
bool | ManualAck |
If true, the user will have to acknowledge the messages. More... | |
jsConsumerConfig | Config |
Consumer configuration. More... | |
bool | Ordered |
If true, this will be an ordered consumer. More... | |
JetStream subscribe options.
These are options that you can provide to JetStream subscribe APIs.
The common usage will be to initialize a structure on the stack by calling jsSubOptions_Init. Note that strings are owned by the application and need to be valid for the duration of the API call this object is passed to.
const char* jsSubOptions::Stream |
If specified, the library will only bind to this stream, otherwise, the library communicates with the server to get the stream name that has the matching subject given to the js_Subscribe family calls.
const char* jsSubOptions::Consumer |
If specified, the js_Subscribe family calls will only attempt to create a subscription for this matching consumer.
That is, the consumer should exist prior to the call, either created by the application calling js_AddConsumer or it should have been created with some other tools such as the NATS cli.
const char* jsSubOptions::Queue |
If specified, the low level NATS subscription will be a queue subscription, which means that the load on the delivery subject will be balanced across multiple members of the same queue group.
This makes sense only if the delivery subject in the Config
field of jsSubOptions is the same for the members of the same group.
When no Durable
name is specified in the Config
block, then the queue name will be used as the consumer's durable name. In this case, the queue name cannot contain the character ".".
bool jsSubOptions::ManualAck |
This has meaning only for asynchronous subscriptions, and only if the consumer's acknowledgment mode is other than js_AckNone.
For asynchronous subscriptions, the default behavior is for the library to acknowledge the message once the user callback returns.
This option allows you to take control of when the message should be acknowledged.
jsConsumerConfig jsSubOptions::Config |
This allows the user to fully configure the JetStream consumer.
bool jsSubOptions::Ordered |
This will create a fifo ephemeral consumer for in order delivery of messages. There are no redeliveries and no acks. Flow control and heartbeats are required and set by default, but the heartbeats value can be overridden in the consumer configuration.