NATS C Client with JetStream and Streaming support
3.2.0
The nats.io C Client, Supported by Synadia Communications Inc.
|
Functions | |
NATS_EXTERN natsStatus | jsStreamConfig_Init (jsStreamConfig *cfg) |
Initializes a streaming configuration structure. More... | |
NATS_EXTERN natsStatus | jsPlacement_Init (jsPlacement *placement) |
Initializes a placement configuration structure. More... | |
NATS_EXTERN natsStatus | jsStreamSource_Init (jsStreamSource *source) |
Initializes a stream source configuration structure. More... | |
NATS_EXTERN natsStatus | jsExternalStream_Init (jsExternalStream *external) |
Initializes an external stream configuration structure. More... | |
NATS_EXTERN natsStatus | js_AddStream (jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode) |
Creates a stream. More... | |
NATS_EXTERN natsStatus | js_UpdateStream (jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode) |
Updates a stream. More... | |
NATS_EXTERN natsStatus | js_PurgeStream (jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode) |
Purges a stream. More... | |
NATS_EXTERN natsStatus | js_DeleteStream (jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode) |
Deletes a stream. More... | |
NATS_EXTERN natsStatus | js_GetMsg (natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode) |
Retrieves a JetStream message from the stream by sequence. More... | |
NATS_EXTERN natsStatus | js_GetLastMsg (natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode) |
Retrieves the last JetStream message from the stream for a given subject. More... | |
NATS_EXTERN natsStatus | js_DeleteMsg (jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode) |
Deletes a message from the stream. More... | |
NATS_EXTERN natsStatus | js_EraseMsg (jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode) |
Erases a message from the stream. More... | |
NATS_EXTERN natsStatus | js_GetStreamInfo (jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode) |
Retreives information from a stream. More... | |
NATS_EXTERN void | jsStreamInfo_Destroy (jsStreamInfo *si) |
Destroys the stream information object. More... | |
NATS_EXTERN natsStatus | jsConsumerConfig_Init (jsConsumerConfig *cc) |
Initializes a consumer configuration structure. More... | |
NATS_EXTERN natsStatus | js_AddConsumer (jsConsumerInfo **ci, jsCtx *js, const char *stream, jsConsumerConfig *cfg, jsOptions *opts, jsErrCode *errCode) |
Adds a JetStream consumer. More... | |
NATS_EXTERN natsStatus | js_GetConsumerInfo (jsConsumerInfo **ci, jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode) |
Retrieves information about a consumer. More... | |
NATS_EXTERN natsStatus | js_DeleteConsumer (jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode) |
Deletes a consumer. More... | |
NATS_EXTERN void | jsConsumerInfo_Destroy (jsConsumerInfo *ci) |
Destroys the consumer information object. More... | |
NATS_EXTERN natsStatus | js_GetAccountInfo (jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode) |
Retrieves information about the JetStream usage from an account. More... | |
NATS_EXTERN void | jsAccountInfo_Destroy (jsAccountInfo *ai) |
Destroys the account information object. More... | |
JetStream Assets Management
NATS_EXTERN natsStatus jsStreamConfig_Init | ( | jsStreamConfig * | cfg | ) |
Use this before setting specific stream configuration options and passing this configuration to some of the stream management APIs.
cfg | the pointer to the jsStreamConfig to initialize. |
NATS_EXTERN natsStatus jsPlacement_Init | ( | jsPlacement * | placement | ) |
Use this before setting specific stream placement options.
placement | the pointer to the jsPlacement to initialize. |
NATS_EXTERN natsStatus jsStreamSource_Init | ( | jsStreamSource * | source | ) |
Use this before setting specific stream source options.
source | the pointer to the jsStreamSource to initialize. |
NATS_EXTERN natsStatus jsExternalStream_Init | ( | jsExternalStream * | external | ) |
Use this before setting specific external stream options.
external | the pointer to the jsExternalStream to initialize. |
NATS_EXTERN natsStatus js_AddStream | ( | jsStreamInfo ** | si, |
jsCtx * | js, | ||
jsStreamConfig * | cfg, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Creates a stream based on the provided configuration (that cannot be NULL
). The name is mandatory and cannot contain .
characters.
NULL
, otherwise, on success you are responsible for freeing this object.si | the location where to store the pointer to the new jsStreamInfo object in response to the creation request, or NULL if the stream information is not needed. |
js | the pointer to the jsCtx context. |
cfg | the pointer to the jsStreamConfig. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_UpdateStream | ( | jsStreamInfo ** | si, |
jsCtx * | js, | ||
jsStreamConfig * | cfg, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Updates a stream based on the provided configuration (that cannot be NULL
). The name is mandatory and cannot contain .
characters.
NULL
, otherwise, on success you are responsible for freeing this object.si | the location where to store the pointer to the new jsStreamInfo object in response to the creation request, or NULL if the stream information is not needed. |
js | the pointer to the jsCtx context. |
cfg | the pointer to the jsStreamConfig. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_PurgeStream | ( | jsCtx * | js, |
const char * | stream, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Purges the stream named stream
.
For more advanced purge options, you can specify them through jsOptions.
NATS_EXTERN natsStatus js_DeleteStream | ( | jsCtx * | js, |
const char * | stream, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
NATS_EXTERN natsStatus js_GetMsg | ( | natsMsg ** | msg, |
jsCtx * | js, | ||
const char * | stream, | ||
uint64_t | seq, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Retrieves a raw stream message stored in JetStream by sequence number.
msg | the memory location where the library will store the pointer to the natsMsg. |
js | the pointer to the jsCtx context. |
stream | the name of the stream. |
seq | the sequence in the stream of the message being retrieved. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_GetLastMsg | ( | natsMsg ** | msg, |
jsCtx * | js, | ||
const char * | stream, | ||
const char * | subject, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Retrieves the last JetStream message from the stream for a given subject.
msg | the memory location where the library will store the pointer to the natsMsg. |
js | the pointer to the jsCtx context. |
stream | the name of the stream. |
subject | the subject for which the last message is being retrieved. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_DeleteMsg | ( | jsCtx * | js, |
const char * | stream, | ||
uint64_t | seq, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Deletes the message at sequence seq
in the stream named stream
.
NATS_EXTERN natsStatus js_EraseMsg | ( | jsCtx * | js, |
const char * | stream, | ||
uint64_t | seq, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Similar to js_DeleteMsg except that the content of the deleted message is erased from stable storage.
NATS_EXTERN natsStatus js_GetStreamInfo | ( | jsStreamInfo ** | si, |
jsCtx * | js, | ||
const char * | stream, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Returns information about the stream named stream
.
To get some detailed information about deleted messages, set this option:
si | the location where to store the pointer to the new jsStreamInfo object in response to the creation request. |
js | the pointer to the jsCtx context. |
stream | the name of the stream which information is retrieved. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN void jsStreamInfo_Destroy | ( | jsStreamInfo * | si | ) |
Releases memory allocated for this stream information object.
si | the pointer to the jsStreamInfo object. |
NATS_EXTERN natsStatus jsConsumerConfig_Init | ( | jsConsumerConfig * | cc | ) |
Use this before adding a consumer.
cc | the pointer to the jsConsumerConfig to initialize. |
NATS_EXTERN natsStatus js_AddConsumer | ( | jsConsumerInfo ** | ci, |
jsCtx * | js, | ||
const char * | stream, | ||
jsConsumerConfig * | cfg, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Adds a consumer based on the provided configuration (that cannot be NULL
).
NULL
, otherwise, on success you are responsible for freeing this object.ci | the location where to store the pointer to the new jsConsumerInfo object in response to the creation request, or NULL if the consumer information is not needed. |
js | the pointer to the jsCtx context. |
stream | the name of the stream. |
cfg | the pointer to the jsConsumerConfig. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_GetConsumerInfo | ( | jsConsumerInfo ** | ci, |
jsCtx * | js, | ||
const char * | stream, | ||
const char * | consumer, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
ci | the location where to store the pointer to the new jsConsumerInfo object. |
js | the pointer to the jsCtx context. |
stream | the name of the stream. |
consumer | the name of the consumer. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN natsStatus js_DeleteConsumer | ( | jsCtx * | js, |
const char * | stream, | ||
const char * | consumer, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Deletes the consumer named consumer
from stream named stream
.
NATS_EXTERN void jsConsumerInfo_Destroy | ( | jsConsumerInfo * | ci | ) |
Releases memory allocated for this consumer information object.
ci | the pointer to the jsConsumerInfo object. |
NATS_EXTERN natsStatus js_GetAccountInfo | ( | jsAccountInfo ** | ai, |
jsCtx * | js, | ||
jsOptions * | opts, | ||
jsErrCode * | errCode | ||
) |
Retrieves information about the JetStream usage from an account.
ai | the location where to store the pointer to the new jsAccountInfo object in response to the account information request. |
js | the pointer to the jsCtx context. |
opts | the pointer to the jsOptions object, possibly NULL . |
errCode | the location where to store the JetStream specific error code, or NULL if not needed. |
NATS_EXTERN void jsAccountInfo_Destroy | ( | jsAccountInfo * | ai | ) |
Releases memory allocated for this account information object.
ai | the pointer to the jsAccountInfo object. |