Loading...
Searching...
No Matches
jsSubOptions Struct Reference
Types

`#include <nats.h>`

## Public Attributes

const char * | Stream
| If specified, the consumer will be bound to this stream name.
const char * | Consumer
| If specified, the subscription will be bound to an existing consumer from the `Stream` without attempting to create.
const char * | Queue
| Queue name for queue subscriptions.
bool | ManualAck
| If true, the user will have to acknowledge the messages.
jsConsumerConfig | Config
| Consumer configuration.
bool | Ordered
| If true, this will be an ordered consumer.

## Detailed Description

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.

Note
  It is the user responsibility to free the strings if they have been allocated.

See also
  jsSubOptions_Init

## Member Data Documentation

## Stream

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.

## Consumer

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.

## Queue

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 ".".

## ManualAck

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.

## Config

jsConsumerConfig jsSubOptions::Config

This allows the user to fully configure the JetStream consumer.

## Ordered

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.

The documentation for this struct was generated from the following file:

- nats.h