NATS C Client with JetStream and Streaming support
3.9.1
The nats.io C Client, Supported by Synadia Communications Inc.
|
Functions | |
NATS_EXTERN natsStatus | natsConnection_Subscribe (natsSubscription **sub, natsConnection *nc, const char *subject, natsMsgHandler cb, void *cbClosure) |
Creates an asynchronous subscription. More... | |
NATS_EXTERN natsStatus | natsConnection_SubscribeTimeout (natsSubscription **sub, natsConnection *nc, const char *subject, int64_t timeout, natsMsgHandler cb, void *cbClosure) |
Creates an asynchronous subscription with a timeout. More... | |
NATS_EXTERN natsStatus | natsConnection_SubscribeSync (natsSubscription **sub, natsConnection *nc, const char *subject) |
Creates a synchronous subcription. More... | |
NATS_EXTERN natsStatus | natsConnection_QueueSubscribe (natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup, natsMsgHandler cb, void *cbClosure) |
Creates an asynchronous queue subscriber. More... | |
NATS_EXTERN natsStatus | natsConnection_QueueSubscribeTimeout (natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup, int64_t timeout, natsMsgHandler cb, void *cbClosure) |
Creates an asynchronous queue subscriber with a timeout. More... | |
NATS_EXTERN natsStatus | natsConnection_QueueSubscribeSync (natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup) |
Creates a synchronous queue subscriber. More... | |
Subscribing functions.
NATS_EXTERN natsStatus natsConnection_Subscribe | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject, | ||
natsMsgHandler | cb, | ||
void * | cbClosure | ||
) |
Expresses interest in the given subject. The subject can have wildcards (see Wildcards). Messages will be delivered to the associated natsMsgHandler.
sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
cb | the natsMsgHandler callback. |
cbClosure | a pointer to an user defined object (can be NULL ). See the natsMsgHandler prototype. |
NATS_EXTERN natsStatus natsConnection_SubscribeTimeout | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject, | ||
int64_t | timeout, | ||
natsMsgHandler | cb, | ||
void * | cbClosure | ||
) |
Expresses interest in the given subject. The subject can have wildcards (see Wildcards). Messages will be delivered to the associated natsMsgHandler.
If no message is received by the given timeout (in milliseconds), the message handler is invoked with a NULL
message.
You can then destroy the subscription in the callback, or simply return, in which case, the message handler will fire again when a message is received or the subscription times-out again.
NULL
.sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
timeout | the interval (in milliseconds) after which, if no message is received, the message handler is invoked with a NULL message. |
cb | the natsMsgHandler callback. |
cbClosure | a pointer to an user defined object (can be NULL ). See the natsMsgHandler prototype. |
NATS_EXTERN natsStatus natsConnection_SubscribeSync | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject | ||
) |
Similar to natsConnection_Subscribe, but creates a synchronous subscription that can be polled via natsSubscription_NextMsg().
sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
NATS_EXTERN natsStatus natsConnection_QueueSubscribe | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject, | ||
const char * | queueGroup, | ||
natsMsgHandler | cb, | ||
void * | cbClosure | ||
) |
Creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously.
sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
queueGroup | the name of the group. |
cb | the natsMsgHandler callback. |
cbClosure | a pointer to an user defined object (can be NULL ). See the natsMsgHandler prototype. |
NATS_EXTERN natsStatus natsConnection_QueueSubscribeTimeout | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject, | ||
const char * | queueGroup, | ||
int64_t | timeout, | ||
natsMsgHandler | cb, | ||
void * | cbClosure | ||
) |
Creates an asynchronous queue subscriber on the given subject. All subscribers with the same queue name will form the queue group and only one member of the group will be selected to receive any given message asynchronously.
If no message is received by the given timeout (in milliseconds), the message handler is invoked with a NULL
message.
You can then destroy the subscription in the callback, or simply return, in which case, the message handler will fire again when a message is received or the subscription times-out again.
NULL
.sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
queueGroup | the name of the group. |
timeout | the interval (in milliseconds) after which, if no message is received, the message handler is invoked with a NULL message. |
cb | the natsMsgHandler callback. |
cbClosure | a pointer to an user defined object (can be NULL ). See the natsMsgHandler prototype. |
NATS_EXTERN natsStatus natsConnection_QueueSubscribeSync | ( | natsSubscription ** | sub, |
natsConnection * | nc, | ||
const char * | subject, | ||
const char * | queueGroup | ||
) |
Similar to natsConnection_QueueSubscribe, but creates a synchronous subscription that can be polled via natsSubscription_NextMsg().
sub | the location where to store the pointer to the newly created natsSubscription object. |
nc | the pointer to the natsConnection object. |
subject | the subject this subscription is created for. |
queueGroup | the name of the group. |