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_Publish (natsConnection *nc, const char *subj, const void *data, int dataLen) |
Publishes data on a subject. More... | |
NATS_EXTERN natsStatus | natsConnection_PublishString (natsConnection *nc, const char *subj, const char *str) |
Publishes a string on a subject. More... | |
NATS_EXTERN natsStatus | natsConnection_PublishMsg (natsConnection *nc, natsMsg *msg) |
Publishes a message on a subject. More... | |
NATS_EXTERN natsStatus | natsConnection_PublishRequest (natsConnection *nc, const char *subj, const char *reply, const void *data, int dataLen) |
Publishes data on a subject expecting replies on the given reply. More... | |
NATS_EXTERN natsStatus | natsConnection_PublishRequestString (natsConnection *nc, const char *subj, const char *reply, const char *str) |
Publishes a string on a subject expecting replies on the given reply. More... | |
NATS_EXTERN natsStatus | natsConnection_Request (natsMsg **replyMsg, natsConnection *nc, const char *subj, const void *data, int dataLen, int64_t timeout) |
Sends a request and waits for a reply. More... | |
NATS_EXTERN natsStatus | natsConnection_RequestString (natsMsg **replyMsg, natsConnection *nc, const char *subj, const char *str, int64_t timeout) |
Sends a request (as a string) and waits for a reply. More... | |
NATS_EXTERN natsStatus | natsConnection_RequestMsg (natsMsg **replyMsg, natsConnection *nc, natsMsg *requestMsg, int64_t timeout) |
Sends a request based on the given requestMsg and waits for a reply. More... | |
Publishing functions
NATS_EXTERN natsStatus natsConnection_Publish | ( | natsConnection * | nc, |
const char * | subj, | ||
const void * | data, | ||
int | dataLen | ||
) |
Publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver.
nc | the pointer to the natsConnection object. |
subj | the subject the data is sent to. |
data | the data to be sent, can be NULL . |
dataLen | the length of the data to be sent. |
NATS_EXTERN natsStatus natsConnection_PublishString | ( | natsConnection * | nc, |
const char * | subj, | ||
const char * | str | ||
) |
Convenient function to publish a string. This call is equivalent to:
nc | the pointer to the natsConnection object. |
subj | the subject the data is sent to. |
str | the string to be sent. |
NATS_EXTERN natsStatus natsConnection_PublishMsg | ( | natsConnection * | nc, |
natsMsg * | msg | ||
) |
Publishes the natsMsg, which includes the subject, an optional reply and optional data.
nc | the pointer to the natsConnection object. |
msg | the pointer to the natsMsg object to send. |
NATS_EXTERN natsStatus natsConnection_PublishRequest | ( | natsConnection * | nc, |
const char * | subj, | ||
const char * | reply, | ||
const void * | data, | ||
int | dataLen | ||
) |
Publishes the data argument to the given subject expecting a response on the reply subject. Use natsConnection_Request() for automatically waiting for a response inline.
nc | the pointer to the natsConnection object. |
subj | the subject the request is sent to. |
reply | the reply on which resonses are expected. |
data | the data to be sent, can be NULL . |
dataLen | the length of the data to be sent. |
NATS_EXTERN natsStatus natsConnection_PublishRequestString | ( | natsConnection * | nc, |
const char * | subj, | ||
const char * | reply, | ||
const char * | str | ||
) |
Convenient function to publish a request as a string. This call is equivalent to:
nc | the pointer to the natsConnection object. |
subj | the subject the request is sent to. |
reply | the reply on which resonses are expected. |
str | the string to send. |
NATS_EXTERN natsStatus natsConnection_Request | ( | natsMsg ** | replyMsg, |
natsConnection * | nc, | ||
const char * | subj, | ||
const void * | data, | ||
int | dataLen, | ||
int64_t | timeout | ||
) |
Sends a request payload and delivers the first response message, or an error, including a timeout if no message was received properly.
replyMsg | the location where to store the pointer to the received natsMsg reply. |
nc | the pointer to the natsConnection object. |
subj | the subject the request is sent to. |
data | the data of the request, can be NULL . |
dataLen | the length of the data to send. |
timeout | in milliseconds, before this call returns NATS_TIMEOUT if no response is received in this alloted time. |
NATS_EXTERN natsStatus natsConnection_RequestString | ( | natsMsg ** | replyMsg, |
natsConnection * | nc, | ||
const char * | subj, | ||
const char * | str, | ||
int64_t | timeout | ||
) |
Convenient function to send a request as a string. This call is equivalent to:
replyMsg | the location where to store the pointer to the received natsMsg reply. |
nc | the pointer to the natsConnection object. |
subj | the subject the request is sent to. |
str | the string to send. |
timeout | in milliseconds, before this call returns NATS_TIMEOUT if no response is received in this alloted time. |
NATS_EXTERN natsStatus natsConnection_RequestMsg | ( | natsMsg ** | replyMsg, |
natsConnection * | nc, | ||
natsMsg * | requestMsg, | ||
int64_t | timeout | ||
) |
Similar to natsConnection_Request but uses requestMsg
to extract subject, and payload to send.
replyMsg | the location where to store the pointer to the received natsMsg reply. |
nc | the pointer to the natsConnection object. |
requestMsg | the message used for the request. |
timeout | in milliseconds, before this call returns NATS_TIMEOUT if no response is received in this alloted time. |