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 stanConnection_Subscribe (stanSubscription **sub, stanConnection *sc, const char *channel, stanMsgHandler cb, void *cbClosure, stanSubOptions *options)
 Creates a subscription. More...
 
NATS_EXTERN natsStatus stanConnection_QueueSubscribe (stanSubscription **sub, stanConnection *sc, const char *channel, const char *queueGroup, stanMsgHandler cb, void *cbClosure, stanSubOptions *options)
 Creates a queue subscription. More...
 

Detailed Description

Subscribing functions.

Function Documentation

◆ stanConnection_Subscribe()

NATS_EXTERN natsStatus stanConnection_Subscribe ( stanSubscription **  sub,
stanConnection sc,
const char *  channel,
stanMsgHandler  cb,
void *  cbClosure,
stanSubOptions options 
)

Expresses interest in the given subject. The subject can NOT have wildcards. Messages will be delivered to the associated stanMsgHandler.

Warning
See warning about connecting to a NATS Server v2.2.0+ in stanConnection_Connect().
Parameters
subthe location where to store the pointer to the newly created natsSubscription object.
scthe pointer to the natsConnection object.
channelthe channel this subscription is created for.
cbthe stanMsgHandler callback.
cbClosurea pointer to an user defined object (can be NULL). See the stanMsgHandler prototype.
optionsthe optional to further configure the subscription.

◆ stanConnection_QueueSubscribe()

NATS_EXTERN natsStatus stanConnection_QueueSubscribe ( stanSubscription **  sub,
stanConnection sc,
const char *  channel,
const char *  queueGroup,
stanMsgHandler  cb,
void *  cbClosure,
stanSubOptions options 
)

Creates a queue subscriber on the given channel. 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.

Warning
See warning about connecting to a NATS Server v2.2.0+ in stanConnection_Connect().
Parameters
subthe location where to store the pointer to the newly created natsSubscription object.
scthe pointer to the natsConnection object.
channelthe channel name this subscription is created for.
queueGroupthe name of the group.
cbthe natsMsgHandler callback.
cbClosurea pointer to an user defined object (can be NULL). See the natsMsgHandler prototype.
optionsthe optional options to further configure this queue subscription.