NATS C Client with JetStream and Streaming support 3.6.1 The nats.io C Client, Supported by Synadia Communications Inc.

Loading...
Searching...
No Matches
Functions
Subscribing
Functions » Streaming Connection

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

## 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

  sub | the location where to store the pointer to the newly created natsSubscription object.
  sc | the pointer to the natsConnection object.
  channel | the channel this subscription is created for.
  cb | the stanMsgHandler callback.
  cbClosure | a pointer to an user defined object (can be `NULL`). See the stanMsgHandler prototype.
  options | the 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

  sub | the location where to store the pointer to the newly created natsSubscription object.
  sc | the pointer to the natsConnection object.
  channel | the channel name 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.
  options | the optional options to further configure this queue subscription.