NATS C Client with JetStream and Streaming support  3.8.0
The nats.io C Client, Supported by Synadia Communications Inc.
Loading...
Searching...
No Matches
Messages

Functions

NATS_EXTERN natsStatus natsMsg_GetMetaData (jsMsgMetaData **new_meta, natsMsg *msg)
 Returns metadata from this JetStream message.
 
NATS_EXTERN void jsMsgMetaData_Destroy (jsMsgMetaData *meta)
 Destroys the message metadata object.
 
NATS_EXTERN natsStatus natsMsg_Ack (natsMsg *msg, jsOptions *opts)
 Acknowledges a message.
 
NATS_EXTERN natsStatus natsMsg_AckSync (natsMsg *msg, jsOptions *opts, jsErrCode *errCode)
 Acknowledges a message and wait for a confirmation.
 
NATS_EXTERN natsStatus natsMsg_Nak (natsMsg *msg, jsOptions *opts)
 Negatively acknowledges a message.
 
NATS_EXTERN natsStatus natsMsg_NakWithDelay (natsMsg *msg, int64_t delay, jsOptions *opts)
 Negatively acknowledges a message.
 
NATS_EXTERN natsStatus natsMsg_InProgress (natsMsg *msg, jsOptions *opts)
 Resets redelivery timer on the server.
 
NATS_EXTERN natsStatus natsMsg_Term (natsMsg *msg, jsOptions *opts)
 Abandon this message.
 
NATS_EXTERN uint64_t natsMsg_GetSequence (natsMsg *msg)
 Returns the sequence number of this JetStream message.
 
NATS_EXTERN int64_t natsMsg_GetTime (natsMsg *msg)
 Returns the timestamp (in UTC) of this JetStream message.
 

Detailed Description

Function specific to JetStream messages

Function Documentation

◆ natsMsg_GetMetaData()

NATS_EXTERN natsStatus natsMsg_GetMetaData ( jsMsgMetaData ** new_meta,
natsMsg * msg )

This works only for JetStream messages that have been received through a subscription callback or calling natsSubscription_NextMsg.

Note
The user must destroy the returned object with jsMsgMetaData_Destroy.
This function will return an error for non JetStream messages.
Parameters
new_metathe location where to store the pointer to the newly created jsMsgMetaData object.
msgthe pointer to the natsMsg object, which should be a JetStream message received through a subscription callback or natsSubscription_NextMsg.

◆ jsMsgMetaData_Destroy()

NATS_EXTERN void jsMsgMetaData_Destroy ( jsMsgMetaData * meta)

Releases memory allocated for this jsMsgMetaData object.

Parameters
metathe pointer to the jsMsgMetaData object.

◆ natsMsg_Ack()

NATS_EXTERN natsStatus natsMsg_Ack ( natsMsg * msg,
jsOptions * opts )

This tells the server that the message was successfully processed and it can move on to the next message.

Parameters
msgthe pointer to the natsMsg object.
optsthe pointer to the jsOptions object, possibly NULL.

◆ natsMsg_AckSync()

NATS_EXTERN natsStatus natsMsg_AckSync ( natsMsg * msg,
jsOptions * opts,
jsErrCode * errCode )

This is the synchronous version of natsMsg_Ack. This indicates successful message processing, and waits for confirmation from the server that the acknowledgment has been processed.

Parameters
msgthe pointer to the natsMsg object.
optsthe pointer to the jsOptions object, possibly NULL.
errCodethe location where to store the JetStream specific error code, or NULL if not needed.

◆ natsMsg_Nak()

NATS_EXTERN natsStatus natsMsg_Nak ( natsMsg * msg,
jsOptions * opts )

This tells the server to redeliver the message. You can configure the number of redeliveries by passing MaxDeliver when you subscribe.

The default is infinite redeliveries.

Parameters
msgthe pointer to the natsMsg object.
optsthe pointer to the jsOptions object, possibly NULL.

◆ natsMsg_NakWithDelay()

NATS_EXTERN natsStatus natsMsg_NakWithDelay ( natsMsg * msg,
int64_t delay,
jsOptions * opts )

This tells the server to redeliver the message after the given delay duration expressed in milliseconds. You can configure the number of redeliveries by passing MaxDeliver when you subscribe.

The default is infinite redeliveries.

Parameters
msgthe pointer to the natsMsg object.
delaythe amount of time before the redelivery expressed in milliseconds.
optsthe pointer to the jsOptions object, possibly NULL.

◆ natsMsg_InProgress()

NATS_EXTERN natsStatus natsMsg_InProgress ( natsMsg * msg,
jsOptions * opts )

This tells the server that this message is being worked on. It resets the redelivery timer on the server.

Parameters
msgthe pointer to the natsMsg object.
optsthe pointer to the jsOptions object, possibly NULL.

◆ natsMsg_Term()

NATS_EXTERN natsStatus natsMsg_Term ( natsMsg * msg,
jsOptions * opts )

This tells the server to not redeliver this message, regardless of the value MaxDeliver.

Parameters
msgthe pointer to the natsMsg object.
optsthe pointer to the jsOptions object, possibly NULL.

◆ natsMsg_GetSequence()

NATS_EXTERN uint64_t natsMsg_GetSequence ( natsMsg * msg)

Returns the sequence number of this JetStream message, or 0 if msg is NULL or not a JetStream message.

Note
This applies to JetStream messages retrieved with js_GetMsg or js_GetLastMsg.
Parameters
msgthe pointer to the natsMsg object.

◆ natsMsg_GetTime()

NATS_EXTERN int64_t natsMsg_GetTime ( natsMsg * msg)

Returns the timestamp (in UTC) of this JetStream message, or 0 if msg is NULL or not a JetStream message.

Note
This applies to JetStream messages retrieved with js_GetMsg or js_GetLastMsg.
Parameters
msgthe pointer to the natsMsg object.