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
Streaming Message
Functions

## Functions
NATS_EXTERN uint64_t | stanMsg_GetSequence (const stanMsg *msg)
| Returns the message's sequence number.
NATS_EXTERN int64_t | stanMsg_GetTimestamp (const stanMsg *msg)
| Returns the message's timestamp.
NATS_EXTERN bool | stanMsg_IsRedelivered (const stanMsg *msg)
| Returns the message's redelivered flag.
NATS_EXTERN const char * | stanMsg_GetData (const stanMsg *msg)
| Returns the message payload.
NATS_EXTERN int | stanMsg_GetDataLength (const stanMsg *msg)
| Returns the message length.
NATS_EXTERN void | stanMsg_Destroy (stanMsg *msg)
| Destroys the message object.

## Detailed Description

NATS Streaming Message.

## Function Documentation

## ◆ stanMsg_GetSequence()

NATS_EXTERN uint64_t stanMsg_GetSequence | ( | const stanMsg * | msg | ) |

Returns the message's sequence number (as assigned by the cluster).

Parameters

  msg | the pointer to the stanMsg object.

## ◆ stanMsg_GetTimestamp()

NATS_EXTERN int64_t stanMsg_GetTimestamp | ( | const stanMsg * | msg | ) |

Returns the message's timestamp (as assigned by the cluster).

Parameters

  msg | the pointer to the stanMsg object.

## ◆ stanMsg_IsRedelivered()

NATS_EXTERN bool stanMsg_IsRedelivered | ( | const stanMsg * | msg | ) |

Returns the message's redelivered flag. This can help detect if this message is a possible duplicate (due to redelivery and at-least-once semantic).

Parameters

  msg | the pointer to the stanMsg object.

## ◆ stanMsg_GetData()

NATS_EXTERN const char * stanMsg_GetData | ( | const stanMsg * | msg | ) |

Returns the message payload, possibly `NULL`.

Note that although the data sent and received from the server is not `NULL` terminated, the NATS C Client does add a `NULL` byte to the received payload. If you expect the received data to be a "string", then this conveniently allows you to call stanMsg_GetData() without having to copy the returned data to a buffer to add the `NULL` byte at the end.

Warning
  The string belongs to the message and must not be freed. Copy it if needed.

Parameters

  msg | the pointer to the stanMsg object.

## ◆ stanMsg_GetDataLength()

NATS_EXTERN int stanMsg_GetDataLength | ( | const stanMsg * | msg | ) |

Returns the message's payload length, possibly 0.

Parameters

  msg | the pointer to the stanMsg object.

## ◆ stanMsg_Destroy()

NATS_EXTERN void stanMsg_Destroy | ( | stanMsg * | msg | ) |

Destroys the message, freeing memory.

Parameters

  msg | the pointer to the stanMsg object to destroy.