# NATS C Client with JetStream and Streaming support: nats.h Source File

Loading...
Searching...
No Matches
nats.h
Go to the documentation of this file.
// Copyright 2015-2023 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef NATS_H_
#define NATS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <stdio.h>
#include "status.h"
#include "version.h"
#if defined(_WIN32)
#include <winsock2.h>
#if defined(nats_EXPORTS)
#define NATS_EXTERN __declspec(dllexport)
#elif defined(nats_IMPORTS)
#define NATS_EXTERN __declspec(dllimport)
#else
#define NATS_EXTERN
#endif
typedef SOCKET natsSock;
#else
#define NATS_EXTERN
typedef int natsSock;
#endif
#define NATS_DEFAULT_URL "nats://localhost:4222"
#define JSMsgSize "Nats-Msg-Size"
#define JSMsgRollup "Nats-Rollup"
#define JSMsgRollupSubject "sub"
#define JSMsgRollupAll "all"
// Headers for republished messages and direct get.
#define JSStream "Nats-Stream"
#define JSSequence "Nats-Sequence"
#define JSLastSequence "Nats-Last-Sequence"
#define JSTimeStamp "Nats-Time-Stamp"
#define JSSubject "Nats-Subject"
//
// Types.
//
typedef struct __natsConnection natsConnection;
typedef struct __natsStatistics natsStatistics;
typedef struct __natsSubscription natsSubscription;
typedef struct __natsMsg natsMsg;
typedef struct __natsOptions natsOptions;
typedef char natsInbox;
typedef struct natsMsgList
{
natsMsg **Msgs;
int Count;
} natsMsgList;
typedef struct natsMetadata
{
// User-provided metadata for the stream, encoded as an array of {"key", "value",...}
const char **List;
// Number of key/value pairs in Metadata, 1/2 of the length of the array.
int Count;
} natsMetadata;
typedef struct __jsCtx jsCtx;
typedef struct jsPubOptions
{
int64_t MaxWait;
const char *MsgId;
const char *ExpectStream;
const char *ExpectLastMsgId;
uint64_t ExpectLastSeq;
uint64_t ExpectLastSubjectSeq;
bool ExpectNoMessage;
} jsPubOptions;
typedef enum
{
js_LimitsPolicy = 0,
js_InterestPolicy,
js_WorkQueuePolicy,
} jsRetentionPolicy;
typedef enum
{
js_DiscardOld = 0,
js_DiscardNew,
} jsDiscardPolicy;
typedef enum
{
js_FileStorage = 0,
js_MemoryStorage,
} jsStorageType;
typedef enum
{
js_StorageCompressionNone = 0,
js_StorageCompressionS2,
} jsStorageCompression;
typedef enum
{
js_DeliverAll = 0,
js_DeliverLast,
js_DeliverNew,
js_DeliverByStartSequence,
js_DeliverByStartTime,
js_DeliverLastPerSubject,
} jsDeliverPolicy;
typedef enum
{
js_AckExplicit = 0,
js_AckNone,
js_AckAll,
} jsAckPolicy;
typedef enum
{
js_ReplayInstant = 0,
js_ReplayOriginal,
} jsReplayPolicy;
typedef struct jsPlacement
{
const char *Cluster;
const char **Tags;
int TagsLen;
} jsPlacement;
typedef struct jsExternalStream
{
const char *APIPrefix;
const char *DeliverPrefix;
} jsExternalStream;
typedef struct jsStreamSource
{
const char *Name;
uint64_t OptStartSeq;
int64_t OptStartTime;
const char *FilterSubject;
jsExternalStream *External;
// Domain and External are mutually exclusive.
// If Domain is set, an External value will be created with
// the APIPrefix constructed based on the Domain value.
const char *Domain;
} jsStreamSource;
typedef struct jsRePublish
{
const char *Source;
const char *Destination;
bool HeadersOnly;
} jsRePublish;
typedef struct jsSubjectTransformConfig
{
const char *Source;
const char *Destination;
} jsSubjectTransformConfig;
typedef struct jsStreamConsumerLimits
{
int64_t InactiveThreshold;
int MaxAckPending;
} jsStreamConsumerLimits;
typedef struct jsStreamConfig {
const char *Name;
const char *Description;
const char **Subjects;
int SubjectsLen;
jsRetentionPolicy Retention;
int64_t MaxConsumers;
int64_t MaxMsgs;
int64_t MaxBytes;
int64_t MaxAge;
int64_t MaxMsgsPerSubject;
int32_t MaxMsgSize;
jsDiscardPolicy Discard;
jsStorageType Storage;
int64_t Replicas;
bool NoAck;
const char *Template;
int64_t Duplicates;
jsPlacement *Placement;
jsStreamSource *Mirror;
jsStreamSource **Sources;
int SourcesLen;
bool Sealed;
bool DenyDelete;
bool DenyPurge;
bool AllowRollup;
// Allow republish of the message after being sequenced and stored.
jsRePublish *RePublish;
// Allow higher performance, direct access to get individual messages. E.g. KeyValue
bool AllowDirect;
// Allow higher performance and unified direct access for mirrors as well.
bool MirrorDirect;
// Allow KV like semantics to also discard new on a per subject basis
bool DiscardNewPerSubject;
natsMetadata Metadata;
jsStorageCompression Compression;
uint64_t FirstSeq;
jsSubjectTransformConfig SubjectTransform;
jsStreamConsumerLimits ConsumerLimits;
} jsStreamConfig;
typedef struct jsLostStreamData
{
uint64_t *Msgs;
int MsgsLen;
uint64_t Bytes;
} jsLostStreamData;
typedef struct jsStreamStateSubject
{
const char *Subject;
uint64_t Msgs;
} jsStreamStateSubject;
typedef struct jsStreamStateSubjects
{
jsStreamStateSubject *List;
int Count;
} jsStreamStateSubjects;
typedef struct jsStreamState
{
uint64_t Msgs;
uint64_t Bytes;
uint64_t FirstSeq;
int64_t FirstTime;
uint64_t LastSeq;
int64_t LastTime;
int64_t NumSubjects;
jsStreamStateSubjects *Subjects;
uint64_t NumDeleted;
uint64_t *Deleted;
int DeletedLen;
jsLostStreamData *Lost;
int64_t Consumers;
} jsStreamState;
typedef struct jsPeerInfo
{
char *Name;
bool Current;
bool Offline;
int64_t Active;
uint64_t Lag;
} jsPeerInfo;
typedef struct jsClusterInfo
{
char *Name;
char *Leader;
jsPeerInfo **Replicas;
int ReplicasLen;
} jsClusterInfo;
typedef struct jsStreamSourceInfo
{
char *Name;
jsExternalStream *External;
uint64_t Lag;
int64_t Active;
const char * FilterSubject;
jsSubjectTransformConfig *SubjectTransforms;
int SubjectTransformsLen;
} jsStreamSourceInfo;
typedef struct jsStreamAlternate
{
const char *Name;
const char *Domain;
const char *Cluster;
} jsStreamAlternate;
typedef struct jsStreamInfo
{
jsStreamConfig *Config;
int64_t Created;
jsStreamState State;
jsClusterInfo *Cluster;
jsStreamSourceInfo *Mirror;
jsStreamSourceInfo **Sources;
int SourcesLen;
jsStreamAlternate **Alternates;
int AlternatesLen;
} jsStreamInfo;
typedef struct jsStreamInfoList
{
jsStreamInfo **List;
int Count;
} jsStreamInfoList;
typedef struct jsStreamNamesList
{
char **List;
int Count;
} jsStreamNamesList;
typedef struct jsConsumerConfig
{
const char *Name;
const char *Durable;
const char *Description;
jsDeliverPolicy DeliverPolicy;
uint64_t OptStartSeq;
int64_t OptStartTime;
jsAckPolicy AckPolicy;
int64_t AckWait;
int64_t MaxDeliver;
int64_t *BackOff;
int BackOffLen;
const char *FilterSubject;
jsReplayPolicy ReplayPolicy;
uint64_t RateLimit;
const char *SampleFrequency;
int64_t MaxWaiting;
int64_t MaxAckPending;
bool FlowControl;
int64_t Heartbeat;
bool HeadersOnly;
// Pull based options.
int64_t MaxRequestBatch;
int64_t MaxRequestExpires;
int64_t MaxRequestMaxBytes;
// Push based options.
const char *DeliverSubject;
const char *DeliverGroup;
// Ephemeral inactivity threshold.
int64_t InactiveThreshold;
// Generally inherited by parent stream and other markers, now can be configured directly.
int64_t Replicas;
// Force memory storage.
bool MemoryStorage;
// Configuration options introduced in 2.10
// Multiple filter subjects
const char **FilterSubjects;
int FilterSubjectsLen;
// User-provided metadata for the consumer, encoded as an array of {"key", "value",...}
natsMetadata Metadata;
} jsConsumerConfig;
typedef struct jsConsumerSequenceMismatch
{
uint64_t Stream;
uint64_t ConsumerClient;
uint64_t ConsumerServer;
} jsConsumerSequenceMismatch;
typedef struct jsSubOptions
{
const char *Stream;
const char *Consumer;
const char *Queue;
bool ManualAck;
jsConsumerConfig Config;
bool Ordered;
} jsSubOptions;
typedef struct jsSequencePair
{
uint64_t Consumer;
uint64_t Stream;
} jsSequencePair;
typedef struct jsSequenceInfo
{
uint64_t Consumer;
uint64_t Stream;
int64_t Last;
} jsSequenceInfo;
typedef struct jsConsumerInfo
{
char *Stream;
char *Name;
int64_t Created;
jsConsumerConfig *Config;
jsSequenceInfo Delivered;
jsSequenceInfo AckFloor;
int64_t NumAckPending;
int64_t NumRedelivered;
int64_t NumWaiting;
uint64_t NumPending;
jsClusterInfo *Cluster;
bool PushBound;
} jsConsumerInfo;
typedef struct jsConsumerInfoList
{
jsConsumerInfo **List;
int Count;
} jsConsumerInfoList;
typedef struct jsConsumerNamesList
{
char **List;
int Count;
} jsConsumerNamesList;
typedef struct jsAPIStats
{
uint64_t Total;
uint64_t Errors;
} jsAPIStats;
typedef struct jsAccountLimits
{
int64_t MaxMemory;
int64_t MaxStore;
int64_t MaxStreams;
int64_t MaxConsumers;
int64_t MaxAckPending;
int64_t MemoryMaxStreamBytes;
int64_t StoreMaxStreamBytes;
bool MaxBytesRequired;
} jsAccountLimits;
typedef struct jsTier
{
const char *Name;
uint64_t Memory;
uint64_t Store;
int64_t Streams;
int64_t Consumers;
jsAccountLimits Limits;
} jsTier;
typedef struct jsAccountInfo
{
uint64_t Memory;
uint64_t Store;
int64_t Streams;
int64_t Consumers;
char *Domain;
jsAPIStats API;
jsAccountLimits Limits;
jsTier **Tiers;
int TiersLen;
} jsAccountInfo;
typedef struct jsMsgMetaData
{
jsSequencePair Sequence;
uint64_t NumDelivered;
uint64_t NumPending;
int64_t Timestamp;
char *Stream;
char *Consumer;
char *Domain;
} jsMsgMetaData;
typedef struct jsPubAck
{
char *Stream;
uint64_t Sequence;
char *Domain;
bool Duplicate;
} jsPubAck;
typedef struct jsPubAckErr
{
natsMsg *Msg;
natsStatus Err;
jsErrCode ErrCode;
const char *ErrText;
} jsPubAckErr;
#ifndef BUILD_IN_DOXYGEN
// Forward declarations
typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
#endif
typedef struct jsDirectGetMsgOptions
{
uint64_t Sequence;
const char *NextBySubject;
const char *LastBySubject;
} jsDirectGetMsgOptions;
typedef struct jsFetchRequest
{
int64_t Expires;
int Batch;
int64_t MaxBytes;
bool NoWait;
int64_t Heartbeat;
} jsFetchRequest;
typedef struct jsOptions
{
const char *Prefix;
const char *Domain;
int64_t Wait;
struct jsOptionsPublishAsync
{
int64_t MaxPending;
// If jsPubAckHandler is specified, the callback will be invoked
// for every asynchronous published message, either as a positive
// result, or with the error encountered when publishing that
// message. If this callback is specified, ErrHandler (see below)
// will be ignored.
jsPubAckHandler AckHandler;
void *AckHandlerClosure;
// This callback is invoked for messages published asynchronously
// when an error is returned by the server or if the library has
// timed-out waiting for an acknowledgment back from the server
// (if publish uses the jsPubOptions.MaxWait).
jsPubAckErrHandler ErrHandler;
void *ErrHandlerClosure;
int64_t StallWait;
} PublishAsync;
struct jsOptionsStream
{
struct jsOptionsStreamPurge
{
const char *Subject;
uint64_t Sequence;
uint64_t Keep;
} Purge;
struct jsOptionsStreamInfo
{
bool DeletedDetails;
const char *SubjectsFilter;
} Info;
} Stream;
} jsOptions;
typedef struct __kvStore kvStore;
typedef struct __kvEntry kvEntry;
typedef struct __kvStatus kvStatus;
typedef struct __kvWatcher kvWatcher;
typedef enum
{
kvOp_Unknown = 0,
kvOp_Put,
kvOp_Delete,
kvOp_Purge,
} kvOperation;
typedef struct kvConfig
{
const char *Bucket;
const char *Description;
int32_t MaxValueSize;
uint8_t History;
int64_t TTL;
int64_t MaxBytes;
jsStorageType StorageType;
int Replicas;
jsRePublish *RePublish;
jsStreamSource *Mirror;
jsStreamSource **Sources;
int SourcesLen;
} kvConfig;
typedef struct kvWatchOptions
{
bool IgnoreDeletes;
bool IncludeHistory;
bool MetaOnly;
int64_t Timeout;
} kvWatchOptions;
typedef struct kvPurgeOptions
{
// How long to wait (in milliseconds) for some operations to complete.
int64_t Timeout;
// When calling kvStore_PurgeDeletes(), all keys that have a delete or
// purge marker as the last entry are gathered and then those keys
// are purged of their content, including the marker.
// Starting with NATS C client v3.3.0, if this option is not specified,
// only the markers older than 30 minutes will be deleted. Use this
// option to set the limit or a negative value to force removal of
// markers regardless of their age.
// The value is expressed as a time in nanoseconds.
int64_t DeleteMarkersOlderThan;
} kvPurgeOptions;
typedef struct kvEntryList
{
kvEntry **Entries;
int Count;
} kvEntryList;
typedef struct kvKeysList
{
char **Keys;
int Count;
} kvKeysList;
#if defined(NATS_HAS_STREAMING)
typedef struct __stanConnection stanConnection;
typedef struct __stanSubscription stanSubscription;
typedef struct __stanMsg stanMsg;
typedef struct __stanConnOptions stanConnOptions;
typedef struct __stanSubOptions stanSubOptions;
#endif
// end of typesGroup
//
// Callbacks.
//
typedef void (*natsMsgHandler)(
natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure);
typedef void (*natsConnectionHandler)(
natsConnection *nc, void *closure);
typedef void (*natsErrHandler)(
natsConnection *nc, natsSubscription *subscription, natsStatus err,
void *closure);
typedef natsStatus (*natsEvLoop_Attach)(
void **userData,
void *loop,
natsConnection *nc,
natsSock socket);
typedef natsStatus (*natsEvLoop_ReadAddRemove)(
void *userData,
bool add);
typedef natsStatus (*natsEvLoop_WriteAddRemove)(
void *userData,
bool add);
typedef natsStatus (*natsEvLoop_Detach)(
void *userData);
typedef natsStatus (*natsUserJWTHandler)(
char **userJWT,
char **customErrTxt,
void *closure);
typedef natsStatus (*natsSignatureHandler)(
char **customErrTxt,
unsigned char **signature,
int *signatureLength,
const char *nonce,
void *closure);
typedef const char* (*natsTokenHandler)(void *closure);
typedef void (*natsOnCompleteCB)(void *closure);
typedef int64_t (*natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure);
#ifdef BUILD_IN_DOXYGEN
typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
#endif
#if defined(NATS_HAS_STREAMING)
typedef void (*stanPubAckHandler)(const char *guid, const char *error, void *closure);
typedef void (*stanMsgHandler)(
stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure);
typedef void (*stanConnectionLostHandler)(
stanConnection *sc, const char* errorTxt, void *closure);
#endif
// end of callbacksGroup
//
// Functions.
//
NATS_EXTERN natsStatus
nats_Open(int64_t lockSpinCount);
NATS_EXTERN const char*
nats_GetVersion(void);
NATS_EXTERN uint32_t
nats_GetVersionNumber(void);
#ifdef BUILD_IN_DOXYGEN
NATS_EXTERN bool nats_CheckCompatibility(void);
#else
#define nats_CheckCompatibility() nats_CheckCompatibilityImpl(NATS_VERSION_REQUIRED_NUMBER, \
NATS_VERSION_NUMBER, \
NATS_VERSION_STRING)
NATS_EXTERN bool
nats_CheckCompatibilityImpl(uint32_t reqVerNumber, uint32_t verNumber, const char *verString);
#endif
NATS_EXTERN int64_t
nats_Now(void);
NATS_EXTERN int64_t
nats_NowInNanoSeconds(void);
NATS_EXTERN void
nats_Sleep(int64_t sleepTime);
NATS_EXTERN const char*
nats_GetLastError(natsStatus *status);
NATS_EXTERN natsStatus
nats_GetLastErrorStack(char *buffer, size_t bufLen);
NATS_EXTERN void
nats_PrintLastErrorStack(FILE *file);
NATS_EXTERN natsStatus
nats_SetMessageDeliveryPoolSize(int max);
NATS_EXTERN void
nats_ReleaseThreadMemory(void);
NATS_EXTERN natsStatus
nats_Sign(const char *encodedSeed,
const char *input,
unsigned char **signature,
int *signatureLength);
NATS_EXTERN void
nats_Close(void);
NATS_EXTERN natsStatus
nats_CloseAndWait(int64_t timeout);
// end of libraryGroup
NATS_EXTERN const char*
natsStatus_GetText(natsStatus s);
// end of statusGroup
NATS_EXTERN natsStatus
natsStatistics_Create(natsStatistics **newStats);
NATS_EXTERN natsStatus
natsStatistics_GetCounts(const natsStatistics *stats,
uint64_t *inMsgs, uint64_t *inBytes,
uint64_t *outMsgs, uint64_t *outBytes,
uint64_t *reconnects);
NATS_EXTERN void
natsStatistics_Destroy(natsStatistics *stats);
// end of statsGroup
NATS_EXTERN natsStatus
natsOptions_Create(natsOptions **newOpts);
/*
* The above is for doxygen. The proper syntax for username/password
* is without the '\' character:
*
* nats://localhost:4222
* nats://user@localhost:4222
* nats://user:password@localhost:4222
*/
NATS_EXTERN natsStatus
natsOptions_SetURL(natsOptions *opts, const char *url);
NATS_EXTERN natsStatus
natsOptions_SetServers(natsOptions *opts, const char** servers, int serversCount);
NATS_EXTERN natsStatus
natsOptions_SetUserInfo(natsOptions *opts, const char *user, const char *password);
NATS_EXTERN natsStatus
natsOptions_SetToken(natsOptions *opts, const char *token);
NATS_EXTERN natsStatus
natsOptions_SetTokenHandler(natsOptions *opts, natsTokenHandler tokenCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetNoRandomize(natsOptions *opts, bool noRandomize);
NATS_EXTERN natsStatus
natsOptions_SetTimeout(natsOptions *opts, int64_t timeout);
NATS_EXTERN natsStatus
natsOptions_SetName(natsOptions *opts, const char *name);
NATS_EXTERN natsStatus
natsOptions_SetSecure(natsOptions *opts, bool secure);
NATS_EXTERN natsStatus
natsOptions_LoadCATrustedCertificates(natsOptions *opts, const char *fileName);
NATS_EXTERN natsStatus
natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates);
NATS_EXTERN natsStatus
natsOptions_LoadCertificatesChain(natsOptions *opts,
const char *certsFileName,
const char *keyFileName);
NATS_EXTERN natsStatus
natsOptions_SetCertificatesChain(natsOptions *opts,
const char *cert,
const char *key);
NATS_EXTERN natsStatus
natsOptions_SetCiphers(natsOptions *opts, const char *ciphers);
NATS_EXTERN natsStatus
natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers);
NATS_EXTERN natsStatus
natsOptions_SetExpectedHostname(natsOptions *opts, const char *hostname);
NATS_EXTERN natsStatus
natsOptions_SkipServerVerification(natsOptions *opts, bool skip);
NATS_EXTERN natsStatus
natsOptions_SetVerbose(natsOptions *opts, bool verbose);
NATS_EXTERN natsStatus
natsOptions_SetPedantic(natsOptions *opts, bool pedantic);
NATS_EXTERN natsStatus
natsOptions_SetPingInterval(natsOptions *opts, int64_t interval);
NATS_EXTERN natsStatus
natsOptions_SetMaxPingsOut(natsOptions *opts, int maxPingsOut);
NATS_EXTERN natsStatus
natsOptions_SetIOBufSize(natsOptions *opts, int ioBufSize);
NATS_EXTERN natsStatus
natsOptions_SetAllowReconnect(natsOptions *opts, bool allow);
NATS_EXTERN natsStatus
natsOptions_SetMaxReconnect(natsOptions *opts, int maxReconnect);
NATS_EXTERN natsStatus
natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait);
NATS_EXTERN natsStatus
natsOptions_SetReconnectJitter(natsOptions *opts, int64_t jitter, int64_t jitterTLS);
NATS_EXTERN natsStatus
natsOptions_SetCustomReconnectDelay(natsOptions *opts,
natsCustomReconnectDelayHandler cb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetReconnectBufSize(natsOptions *opts, int reconnectBufSize);
NATS_EXTERN natsStatus
natsOptions_SetMaxPendingMsgs(natsOptions *opts, int maxPending);
NATS_EXTERN natsStatus
natsOptions_SetErrorHandler(natsOptions *opts, natsErrHandler errHandler,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetClosedCB(natsOptions *opts, natsConnectionHandler closedCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetDisconnectedCB(natsOptions *opts,
natsConnectionHandler disconnectedCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetReconnectedCB(natsOptions *opts,
natsConnectionHandler reconnectedCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetDiscoveredServersCB(natsOptions *opts,
natsConnectionHandler discoveredServersCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetIgnoreDiscoveredServers(natsOptions *opts, bool ignore);
NATS_EXTERN natsStatus
natsOptions_SetLameDuckModeCB(natsOptions *opts,
natsConnectionHandler lameDuckCb,
void *closure);
NATS_EXTERN natsStatus
natsOptions_SetEventLoop(natsOptions *opts,
void *loop,
natsEvLoop_Attach attachCb,
natsEvLoop_ReadAddRemove readCb,
natsEvLoop_WriteAddRemove writeCb,
natsEvLoop_Detach detachCb);
NATS_EXTERN natsStatus
natsOptions_UseGlobalMessageDelivery(natsOptions *opts, bool global);
NATS_EXTERN natsStatus
natsOptions_IPResolutionOrder(natsOptions *opts, int order);
NATS_EXTERN natsStatus
natsOptions_SetSendAsap(natsOptions *opts, bool sendAsap);
NATS_EXTERN natsStatus
natsOptions_UseOldRequestStyle(natsOptions *opts, bool useOldStyle);
NATS_EXTERN natsStatus
natsOptions_SetFailRequestsOnDisconnect(natsOptions *opts, bool failRequests);
NATS_EXTERN natsStatus
natsOptions_SetNoEcho(natsOptions *opts, bool noEcho);
NATS_EXTERN natsStatus
natsOptions_SetRetryOnFailedConnect(natsOptions *opts, bool retry,
natsConnectionHandler connectedCb, void* closure);
NATS_EXTERN natsStatus
natsOptions_SetUserCredentialsCallbacks(natsOptions *opts,
natsUserJWTHandler ujwtCB,
void *ujwtClosure,
natsSignatureHandler sigCB,
void *sigClosure);
NATS_EXTERN natsStatus
natsOptions_SetUserCredentialsFromFiles(natsOptions *opts,
const char *userOrChainedFile,
const char *seedFile);
NATS_EXTERN natsStatus
natsOptions_SetUserCredentialsFromMemory(natsOptions *opts,
const char *jwtAndSeedContent);
NATS_EXTERN natsStatus
natsOptions_SetNKey(natsOptions *opts,
const char *pubKey,
natsSignatureHandler sigCB,
void *sigClosure);
NATS_EXTERN natsStatus
natsOptions_SetNKeyFromSeed(natsOptions *opts,
const char *pubKey,
const char *seedFile);
NATS_EXTERN natsStatus
natsOptions_SetWriteDeadline(natsOptions *opts, int64_t deadline);
NATS_EXTERN natsStatus
natsOptions_DisableNoResponders(natsOptions *opts, bool disabled);
NATS_EXTERN natsStatus
natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix);
NATS_EXTERN natsStatus
natsOptions_SetMessageBufferPadding(natsOptions *opts, int paddingSize);
NATS_EXTERN void
natsOptions_Destroy(natsOptions *opts);
// end of optsGroup
#if defined(NATS_HAS_STREAMING)
NATS_EXTERN natsStatus
stanConnOptions_Create(stanConnOptions **newOpts);
NATS_EXTERN natsStatus
stanConnOptions_SetURL(stanConnOptions *opts, const char *url);
NATS_EXTERN natsStatus
stanConnOptions_SetNATSOptions(stanConnOptions *opts, natsOptions *nOpts);
NATS_EXTERN natsStatus
stanConnOptions_SetConnectionWait(stanConnOptions *opts, int64_t wait);
NATS_EXTERN natsStatus
stanConnOptions_SetPubAckWait(stanConnOptions *opts, int64_t wait);
NATS_EXTERN natsStatus
stanConnOptions_SetDiscoveryPrefix(stanConnOptions *opts, const char *prefix);
NATS_EXTERN natsStatus
stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage);
NATS_EXTERN natsStatus
stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut);
NATS_EXTERN natsStatus
stanConnOptions_SetConnectionLostHandler(stanConnOptions *opts, stanConnectionLostHandler handler, void *closure);
NATS_EXTERN void
stanConnOptions_Destroy(stanConnOptions *opts);
// end of stanConnOptsGroup
NATS_EXTERN natsStatus
stanSubOptions_Create(stanSubOptions **newOpts);
NATS_EXTERN natsStatus
stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName);
NATS_EXTERN natsStatus
stanSubOptions_SetAckWait(stanSubOptions *opts, int64_t wait);
NATS_EXTERN natsStatus
stanSubOptions_SetMaxInflight(stanSubOptions *opts, int maxInflight);
NATS_EXTERN natsStatus
stanSubOptions_StartAtSequence(stanSubOptions *opts, uint64_t seq);
NATS_EXTERN natsStatus
stanSubOptions_StartAtTime(stanSubOptions *opts, int64_t time);
NATS_EXTERN natsStatus
stanSubOptions_StartAtTimeDelta(stanSubOptions *opts, int64_t delta);
NATS_EXTERN natsStatus
stanSubOptions_StartWithLastReceived(stanSubOptions *opts);
NATS_EXTERN natsStatus
stanSubOptions_DeliverAllAvailable(stanSubOptions *opts);
NATS_EXTERN natsStatus
stanSubOptions_SetManualAckMode(stanSubOptions *opts, bool manual);
NATS_EXTERN void
stanSubOptions_Destroy(stanSubOptions *opts);
// end of stanSubOptsGroup
#endif
NATS_EXTERN natsStatus
natsInbox_Create(natsInbox **newInbox);
NATS_EXTERN void
natsInbox_Destroy(natsInbox *inbox);
// end of inboxGroup
NATS_EXTERN void
natsMsgList_Destroy(natsMsgList *list);
NATS_EXTERN natsStatus
natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply,
const char *data, int dataLen);
NATS_EXTERN const char*
natsMsg_GetSubject(const natsMsg *msg);
NATS_EXTERN const char*
natsMsg_GetReply(const natsMsg *msg);
NATS_EXTERN const char*
natsMsg_GetData(const natsMsg *msg);
NATS_EXTERN int
natsMsg_GetDataLength(const natsMsg *msg);
NATS_EXTERN natsStatus
natsMsgHeader_Set(natsMsg *msg, const char *key, const char *value);
NATS_EXTERN natsStatus
natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value);
NATS_EXTERN natsStatus
natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value);
NATS_EXTERN natsStatus
natsMsgHeader_Values(natsMsg *msg, const char *key, const char* **values, int *count);
NATS_EXTERN natsStatus
natsMsgHeader_Keys(natsMsg *msg, const char* **keys, int *count);
NATS_EXTERN natsStatus
natsMsgHeader_Delete(natsMsg *msg, const char *key);
NATS_EXTERN bool
natsMsg_IsNoResponders(natsMsg *msg);
NATS_EXTERN void
natsMsg_Destroy(natsMsg *msg);
// end of msgGroup
#if defined(NATS_HAS_STREAMING)
NATS_EXTERN uint64_t
stanMsg_GetSequence(const stanMsg *msg);
NATS_EXTERN int64_t
stanMsg_GetTimestamp(const stanMsg *msg);
NATS_EXTERN bool
stanMsg_IsRedelivered(const stanMsg *msg);
NATS_EXTERN const char*
stanMsg_GetData(const stanMsg *msg);
NATS_EXTERN int
stanMsg_GetDataLength(const stanMsg *msg);
NATS_EXTERN void
stanMsg_Destroy(stanMsg *msg);
// end of stanMsgGroup
#endif
NATS_EXTERN natsStatus
natsConnection_Connect(natsConnection **nc, natsOptions *options);
NATS_EXTERN void
natsConnection_ProcessReadEvent(natsConnection *nc);
NATS_EXTERN void
natsConnection_ProcessWriteEvent(natsConnection *nc);
NATS_EXTERN natsStatus
natsConnection_ConnectTo(natsConnection **nc, const char *urls);
NATS_EXTERN bool
natsConnection_IsClosed(natsConnection *nc);
NATS_EXTERN bool
natsConnection_IsReconnecting(natsConnection *nc);
bool
natsConnection_IsDraining(natsConnection *nc);
NATS_EXTERN natsConnStatus
natsConnection_Status(natsConnection *nc);
NATS_EXTERN int
natsConnection_Buffered(natsConnection *nc);
NATS_EXTERN natsStatus
natsConnection_Flush(natsConnection *nc);
NATS_EXTERN natsStatus
natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout);
NATS_EXTERN int64_t
natsConnection_GetMaxPayload(natsConnection *nc);
NATS_EXTERN natsStatus
natsConnection_GetStats(natsConnection *nc, natsStatistics *stats);
NATS_EXTERN natsStatus
natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize);
NATS_EXTERN natsStatus
natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize);
NATS_EXTERN natsStatus
natsConnection_GetServers(natsConnection *nc, char ***servers, int *count);
NATS_EXTERN natsStatus
natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count);
NATS_EXTERN natsStatus
natsConnection_GetLastError(natsConnection *nc, const char **lastError);
NATS_EXTERN natsStatus
natsConnection_GetClientID(natsConnection *nc, uint64_t *cid);
NATS_EXTERN natsStatus
natsConnection_Drain(natsConnection *nc);
NATS_EXTERN natsStatus
natsConnection_DrainTimeout(natsConnection *nc, int64_t timeout);
NATS_EXTERN natsStatus
natsConnection_Sign(natsConnection *nc,
const unsigned char *message, int messageLen,
unsigned char sig[64]);
NATS_EXTERN natsStatus
natsConnection_GetClientIP(natsConnection *nc, char **ip);
NATS_EXTERN natsStatus
natsConnection_GetRTT(natsConnection *nc, int64_t *rtt);
NATS_EXTERN natsStatus
natsConnection_HasHeaderSupport(natsConnection *nc);
natsStatus
natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port);
NATS_EXTERN void
natsConnection_Close(natsConnection *nc);
NATS_EXTERN void
natsConnection_Destroy(natsConnection *nc);
// end of connMgtGroup
NATS_EXTERN natsStatus
natsConnection_Publish(natsConnection *nc, const char *subj,
const void *data, int dataLen);
NATS_EXTERN natsStatus
natsConnection_PublishString(natsConnection *nc, const char *subj,
const char *str);
NATS_EXTERN natsStatus
natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg);
NATS_EXTERN natsStatus
natsConnection_PublishRequest(natsConnection *nc, const char *subj,
const char *reply, const void *data, int dataLen);
NATS_EXTERN natsStatus
natsConnection_PublishRequestString(natsConnection *nc, const char *subj,
const char *reply, const char *str);
NATS_EXTERN natsStatus
natsConnection_Request(natsMsg **replyMsg, natsConnection *nc, const char *subj,
const void *data, int dataLen, int64_t timeout);
NATS_EXTERN natsStatus
natsConnection_RequestString(natsMsg **replyMsg, natsConnection *nc,
const char *subj, const char *str,
int64_t timeout);
NATS_EXTERN natsStatus
natsConnection_RequestMsg(natsMsg **replyMsg, natsConnection *nc,
natsMsg *requestMsg, int64_t timeout);
// end of connPubGroup
NATS_EXTERN natsStatus
natsConnection_Subscribe(natsSubscription **sub, natsConnection *nc,
const char *subject, natsMsgHandler cb,
void *cbClosure);
NATS_EXTERN natsStatus
natsConnection_SubscribeTimeout(natsSubscription **sub, natsConnection *nc,
const char *subject, int64_t timeout,
natsMsgHandler cb, void *cbClosure);
NATS_EXTERN natsStatus
natsConnection_SubscribeSync(natsSubscription **sub, natsConnection *nc,
const char *subject);
NATS_EXTERN natsStatus
natsConnection_QueueSubscribe(natsSubscription **sub, natsConnection *nc,
const char *subject, const char *queueGroup,
natsMsgHandler cb, void *cbClosure);
NATS_EXTERN natsStatus
natsConnection_QueueSubscribeTimeout(natsSubscription **sub, natsConnection *nc,
const char *subject, const char *queueGroup,
int64_t timeout, natsMsgHandler cb, void *cbClosure);
NATS_EXTERN natsStatus
natsConnection_QueueSubscribeSync(natsSubscription **sub, natsConnection *nc,
const char *subject, const char *queueGroup);
// end of connSubGroup
// end of connGroup
NATS_EXTERN natsStatus
natsSubscription_NoDeliveryDelay(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_NextMsg(natsMsg **nextMsg, natsSubscription *sub,
int64_t timeout);
NATS_EXTERN natsStatus
natsSubscription_Unsubscribe(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_AutoUnsubscribe(natsSubscription *sub, int max);
NATS_EXTERN natsStatus
natsSubscription_QueuedMsgs(natsSubscription *sub, uint64_t *queuedMsgs);
NATS_EXTERN int64_t
natsSubscription_GetID(natsSubscription* sub);
NATS_EXTERN const char*
natsSubscription_GetSubject(natsSubscription* sub);
NATS_EXTERN natsStatus
natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit);
NATS_EXTERN natsStatus
natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit);
NATS_EXTERN natsStatus
natsSubscription_GetPending(natsSubscription *sub, int *msgs, int *bytes);
NATS_EXTERN natsStatus
natsSubscription_GetDelivered(natsSubscription *sub, int64_t *msgs);
NATS_EXTERN natsStatus
natsSubscription_GetDropped(natsSubscription *sub, int64_t *msgs);
NATS_EXTERN natsStatus
natsSubscription_GetMaxPending(natsSubscription *sub, int *msgs, int *bytes);
NATS_EXTERN natsStatus
natsSubscription_ClearMaxPending(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_GetStats(natsSubscription *sub,
int *pendingMsgs,
int *pendingBytes,
int *maxPendingMsgs,
int *maxPendingBytes,
int64_t *deliveredMsgs,
int64_t *droppedMsgs);
NATS_EXTERN bool
natsSubscription_IsValid(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_Drain(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_DrainTimeout(natsSubscription *sub, int64_t timeout);
NATS_EXTERN natsStatus
natsSubscription_WaitForDrainCompletion(natsSubscription *sub, int64_t timeout);
NATS_EXTERN natsStatus
natsSubscription_DrainCompletionStatus(natsSubscription *sub);
NATS_EXTERN natsStatus
natsSubscription_SetOnCompleteCB(natsSubscription *sub, natsOnCompleteCB cb, void *closure);
NATS_EXTERN void
natsSubscription_Destroy(natsSubscription *sub);
// end of subGroup
#if defined(NATS_HAS_STREAMING)
NATS_EXTERN natsStatus
stanConnection_Connect(stanConnection **sc, const char *clusterID, const char *clientID,
stanConnOptions *options);
NATS_EXTERN natsStatus
stanConnection_GetNATSConnection(stanConnection *sc, natsConnection **nc);
NATS_EXTERN void
stanConnection_ReleaseNATSConnection(stanConnection *sc);
NATS_EXTERN natsStatus
stanConnection_Close(stanConnection *sc);
NATS_EXTERN natsStatus
stanConnection_Destroy(stanConnection *sc);
// end of stanConnMgtGroup
NATS_EXTERN natsStatus
stanConnection_Publish(stanConnection *sc, const char *channel,
const void *data, int dataLen);
NATS_EXTERN natsStatus
stanConnection_PublishAsync(stanConnection *sc, const char *channel,
const void *data, int dataLen,
stanPubAckHandler ah, void *ahClosure);
// end of stanConnPubGroup
NATS_EXTERN natsStatus
stanConnection_Subscribe(stanSubscription **sub, stanConnection *sc,
const char *channel, stanMsgHandler cb,
void *cbClosure, stanSubOptions *options);
NATS_EXTERN natsStatus
stanConnection_QueueSubscribe(stanSubscription **sub, stanConnection *sc,
const char *channel, const char *queueGroup,
stanMsgHandler cb, void *cbClosure, stanSubOptions *options);
// end of stanConnSubGroup
// end of stanConnGroup
NATS_EXTERN natsStatus
stanSubscription_SetOnCompleteCB(stanSubscription *sub, natsOnCompleteCB cb, void *closure);
NATS_EXTERN natsStatus
stanSubscription_AckMsg(stanSubscription *sub, stanMsg *msg);
NATS_EXTERN natsStatus
stanSubscription_Unsubscribe(stanSubscription *sub);
NATS_EXTERN natsStatus
stanSubscription_Close(stanSubscription *sub);
NATS_EXTERN void
stanSubscription_Destroy(stanSubscription *sub);
// end of stanSubGroup
#endif
NATS_EXTERN natsStatus
jsOptions_Init(jsOptions *opts);
NATS_EXTERN natsStatus
natsConnection_JetStream(jsCtx **js, natsConnection *nc, jsOptions *opts);
NATS_EXTERN void
jsCtx_Destroy(jsCtx *js);
NATS_EXTERN natsStatus
jsStreamConfig_Init(jsStreamConfig *cfg);
NATS_EXTERN natsStatus
jsPlacement_Init(jsPlacement *placement);
NATS_EXTERN natsStatus
jsStreamSource_Init(jsStreamSource *source);
NATS_EXTERN natsStatus
jsExternalStream_Init(jsExternalStream *external);
NATS_EXTERN natsStatus
jsRePublish_Init(jsRePublish *rp);
NATS_EXTERN natsStatus
js_AddStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_UpdateStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_GetMsg(natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_GetLastMsg(natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
jsDirectGetMsgOptions_Init(jsDirectGetMsgOptions *opts);
NATS_EXTERN natsStatus
js_DirectGetMsg(natsMsg **msg, jsCtx *js, const char *stream, jsOptions *opts, jsDirectGetMsgOptions *dgOpts);
NATS_EXTERN natsStatus
js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsStreamInfo_Destroy(jsStreamInfo *si);
NATS_EXTERN natsStatus
js_Streams(jsStreamInfoList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsStreamInfoList_Destroy(jsStreamInfoList *list);
NATS_EXTERN natsStatus
js_StreamNames(jsStreamNamesList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsStreamNamesList_Destroy(jsStreamNamesList *list);
NATS_EXTERN natsStatus
jsConsumerConfig_Init(jsConsumerConfig *cc);
NATS_EXTERN natsStatus
js_AddConsumer(jsConsumerInfo **ci, jsCtx *js,
const char *stream, jsConsumerConfig *cfg,
jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_UpdateConsumer(jsConsumerInfo **ci, jsCtx *js,
const char *stream, jsConsumerConfig *cfg,
jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_GetConsumerInfo(jsConsumerInfo **ci, jsCtx *js,
const char *stream, const char *consumer,
jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer,
jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsConsumerInfo_Destroy(jsConsumerInfo *ci);
NATS_EXTERN natsStatus
js_Consumers(jsConsumerInfoList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsConsumerInfoList_Destroy(jsConsumerInfoList *list);
NATS_EXTERN natsStatus
js_ConsumerNames(jsConsumerNamesList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsConsumerNamesList_Destroy(jsConsumerNamesList *list);
NATS_EXTERN natsStatus
js_GetAccountInfo(jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsAccountInfo_Destroy(jsAccountInfo *ai);
// end of jsAssetsGroup
NATS_EXTERN natsStatus
jsPubOptions_Init(jsPubOptions *opts);
NATS_EXTERN natsStatus
js_Publish(jsPubAck **pubAck, jsCtx *js, const char *subj, const void *data, int dataLen,
jsPubOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_PublishMsg(jsPubAck **pubAck, jsCtx *js, natsMsg *msg,
jsPubOptions *opts, jsErrCode *errCode);
NATS_EXTERN void
jsPubAck_Destroy(jsPubAck *pubAck);
NATS_EXTERN natsStatus
js_PublishAsync(jsCtx *js, const char *subj, const void *data, int dataLen,
jsPubOptions *opts);
NATS_EXTERN natsStatus
js_PublishMsgAsync(jsCtx *js, natsMsg **msg, jsPubOptions *opts);
NATS_EXTERN natsStatus
js_PublishAsyncComplete(jsCtx *js, jsPubOptions *opts);
NATS_EXTERN natsStatus
js_PublishAsyncGetPendingList(natsMsgList *pending, jsCtx *js);
// end of jsPubGroup
NATS_EXTERN natsStatus
jsSubOptions_Init(jsSubOptions *opts);
NATS_EXTERN natsStatus
js_Subscribe(natsSubscription **sub, jsCtx *js, const char *subject,
natsMsgHandler cb, void* cbClosure,
jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject,
jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
NATS_EXTERN natsStatus
js_PullSubscribe(natsSubscription **sub, jsCtx *js, const char *subject, const char *durable,
jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
NATS_EXTERN natsStatus
natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout,
jsErrCode *errCode);
NATS_EXTERN natsStatus
jsFetchRequest_Init(jsFetchRequest *request);
NATS_EXTERN natsStatus
natsSubscription_FetchRequest(natsMsgList *list, natsSubscription *sub, jsFetchRequest *request);
NATS_EXTERN natsStatus
natsSubscription_GetConsumerInfo(jsConsumerInfo **ci, natsSubscription *sub,
jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
natsSubscription_GetSequenceMismatch(jsConsumerSequenceMismatch *csm, natsSubscription *sub);
// end of jsSubGroup
NATS_EXTERN natsStatus
natsMsg_GetMetaData(jsMsgMetaData **new_meta, natsMsg *msg);
NATS_EXTERN void
jsMsgMetaData_Destroy(jsMsgMetaData *meta);
NATS_EXTERN natsStatus
natsMsg_Ack(natsMsg *msg, jsOptions *opts);
NATS_EXTERN natsStatus
natsMsg_AckSync(natsMsg *msg, jsOptions *opts, jsErrCode *errCode);
NATS_EXTERN natsStatus
natsMsg_Nak(natsMsg *msg, jsOptions *opts);
NATS_EXTERN natsStatus
natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts);
NATS_EXTERN natsStatus
natsMsg_InProgress(natsMsg *msg, jsOptions *opts);
NATS_EXTERN natsStatus
natsMsg_Term(natsMsg *msg, jsOptions *opts);
NATS_EXTERN uint64_t
natsMsg_GetSequence(natsMsg *msg);
NATS_EXTERN int64_t
natsMsg_GetTime(natsMsg *msg);
// end of jsMsg
// end of jsGroup
NATS_EXTERN natsStatus
kvConfig_Init(kvConfig *cfg);
NATS_EXTERN natsStatus
js_CreateKeyValue(kvStore **new_kv, jsCtx *js, kvConfig *cfg);
NATS_EXTERN natsStatus
js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket);
NATS_EXTERN natsStatus
js_DeleteKeyValue(jsCtx *js, const char *bucket);
NATS_EXTERN void
kvStore_Destroy(kvStore *kv);
// end of kvGroupMgt
NATS_EXTERN const char*
kvEntry_Bucket(kvEntry *e);
NATS_EXTERN const char*
kvEntry_Key(kvEntry *e);
NATS_EXTERN const void*
kvEntry_Value(kvEntry *e);
NATS_EXTERN int
kvEntry_ValueLen(kvEntry *e);
NATS_EXTERN const char*
kvEntry_ValueString(kvEntry *e);
NATS_EXTERN uint64_t
kvEntry_Revision(kvEntry *e);
NATS_EXTERN int64_t
kvEntry_Created(kvEntry *e);
NATS_EXTERN uint64_t
kvEntry_Delta(kvEntry *e);
NATS_EXTERN kvOperation
kvEntry_Operation(kvEntry *e);
NATS_EXTERN void
kvEntry_Destroy(kvEntry *e);
// end of kvEntry
NATS_EXTERN natsStatus
kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key);
NATS_EXTERN natsStatus
kvStore_GetRevision(kvEntry **new_entry, kvStore *kv, const char *key, uint64_t revision);
NATS_EXTERN natsStatus
kvStore_Put(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
NATS_EXTERN natsStatus
kvStore_PutString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
NATS_EXTERN natsStatus
kvStore_Create(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
NATS_EXTERN natsStatus
kvStore_CreateString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
NATS_EXTERN natsStatus
kvStore_Update(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last);
NATS_EXTERN natsStatus
kvStore_UpdateString(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last);
NATS_EXTERN natsStatus
kvStore_Delete(kvStore *kv, const char *key);
NATS_EXTERN natsStatus
kvStore_Purge(kvStore *kv, const char *key, kvPurgeOptions *opts);
NATS_EXTERN natsStatus
kvWatchOptions_Init(kvWatchOptions *opts);
NATS_EXTERN natsStatus
kvPurgeOptions_Init(kvPurgeOptions *opts);
NATS_EXTERN natsStatus
kvStore_PurgeDeletes(kvStore *kv, kvPurgeOptions *opts);
NATS_EXTERN natsStatus
kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, kvWatchOptions *opts);
NATS_EXTERN natsStatus
kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, kvWatchOptions *opts);
NATS_EXTERN natsStatus
kvStore_Keys(kvKeysList *list, kvStore *kv, kvWatchOptions *opts);
NATS_EXTERN void
kvKeysList_Destroy(kvKeysList *list);
NATS_EXTERN natsStatus
kvStore_History(kvEntryList *list, kvStore *kv, const char *key, kvWatchOptions *opts);
NATS_EXTERN void
kvEntryList_Destroy(kvEntryList *list);
NATS_EXTERN const char*
kvStore_Bucket(kvStore *kv);
// PurgeDeletes
NATS_EXTERN natsStatus
kvStore_Status(kvStatus **new_status, kvStore *kv);
NATS_EXTERN natsStatus
kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout);
NATS_EXTERN natsStatus
kvWatcher_Stop(kvWatcher *w);
NATS_EXTERN void
kvWatcher_Destroy(kvWatcher *w);
// end of kvWatcher
NATS_EXTERN const char*
kvStatus_Bucket(kvStatus *sts);
NATS_EXTERN uint64_t
kvStatus_Values(kvStatus *sts);
NATS_EXTERN int64_t
kvStatus_History(kvStatus *sts);
NATS_EXTERN int64_t
kvStatus_TTL(kvStatus *sts);
NATS_EXTERN int64_t
kvStatus_Replicas(kvStatus *sts);
NATS_EXTERN uint64_t
kvStatus_Bytes(kvStatus *sts);
NATS_EXTERN void
kvStatus_Destroy(kvStatus *sts);
// end of kvStatus
// end of kvGroup
// end of funcGroup
//
// Microservices.
//
typedef struct micro_client_s microClient;
typedef struct __for_forward_compatibility_only microClientConfig;
typedef struct micro_endpoint_s microEndpoint;
typedef struct micro_endpoint_config_s microEndpointConfig;
typedef struct micro_endpoint_info_s microEndpointInfo;
typedef struct micro_endpoint_stats_s microEndpointStats;
typedef struct micro_error_s microError;
typedef struct micro_group_s microGroup;
typedef struct micro_request_s microRequest;
typedef struct micro_service_s microService;
typedef struct micro_service_config_s microServiceConfig;
typedef struct micro_service_info_s microServiceInfo;
typedef struct micro_service_stats_s microServiceStats;
// end of microTypes
typedef microError *(*microRequestHandler)(microRequest *req);
typedef void (*microErrorHandler)(microService *m, microEndpoint *ep, natsStatus s);
typedef void (*microDoneHandler)(microService *m);
// end of microCallbacks
struct micro_endpoint_config_s
{
const char *Name;
const char *Subject;
natsMetadata Metadata;
microRequestHandler Handler;
void *State;
};
struct micro_endpoint_info_s
{
const char *Name;
const char *Subject;
natsMetadata Metadata;
};
struct micro_endpoint_stats_s
{
const char *Name;
const char *Subject;
int64_t NumRequests;
int64_t NumErrors;
int64_t ProcessingTimeSeconds;
int64_t ProcessingTimeNanoseconds;
int64_t AverageProcessingTimeNanoseconds;
char LastErrorString[2048];
};
struct micro_service_config_s
{
const char *Name;
const char *Version;
const char *Description;
natsMetadata Metadata;
microEndpointConfig *Endpoint;
microRequestHandler StatsHandler;
microErrorHandler ErrHandler;
microDoneHandler DoneHandler;
void *State;
};
struct micro_service_info_s
{
const char *Type;
const char *Name;
const char *Version;
const char *Description;
const char *Id;
natsMetadata Metadata;
microEndpointInfo *Endpoints;
int EndpointsLen;
};
struct micro_service_stats_s
{
const char *Type;
const char *Name;
const char *Version;
const char *Id;
int64_t Started;
microEndpointStats *Endpoints;
int EndpointsLen;
};
// end of microStructs
#define MICRO_API_PREFIX "$SRV"
#define MICRO_INFO_RESPONSE_TYPE "io.nats.micro.v1.info_response"
#define MICRO_INFO_VERB "INFO"
#define MICRO_PING_RESPONSE_TYPE "io.nats.micro.v1.ping_response"
#define MICRO_PING_VERB "PING"
#define MICRO_STATS_RESPONSE_TYPE "io.nats.micro.v1.stats_response"
#define MICRO_STATS_VERB "STATS"
#define MICRO_STATUS_HDR "Nats-Status"
#define MICRO_ERROR_HDR "Nats-Service-Error"
#define MICRO_ERROR_CODE_HDR "Nats-Service-Error-Code"
// end of microConstants
NATS_EXTERN microError *
micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config);
NATS_EXTERN microError *
microService_AddEndpoint(microService *m, microEndpointConfig *config);
NATS_EXTERN microError *
microService_AddGroup(microGroup **new_group, microService *m, const char *prefix);
NATS_EXTERN microError *
microService_Destroy(microService *m);
NATS_EXTERN natsConnection *
microService_GetConnection(microService *m);
NATS_EXTERN microError *
microService_GetInfo(microServiceInfo **new_info, microService *m);
NATS_EXTERN void *
microService_GetState(microService *m);
NATS_EXTERN microError *
microService_GetStats(microServiceStats **new_stats, microService *m);
NATS_EXTERN bool
microService_IsStopped(microService *m);
NATS_EXTERN microError *
microService_Run(microService *m);
NATS_EXTERN microError *microService_Stop(microService *m);
// end of microServiceFunctions
NATS_EXTERN microError *
microGroup_AddGroup(microGroup **new_group, microGroup *parent, const char *prefix);
NATS_EXTERN microError *
microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config);
// end of microGroupFunctions
NATS_EXTERN microError *
microRequest_AddHeader(microRequest *req, const char *key, const char *value);
NATS_EXTERN microError *
microRequest_DeleteHeader(microRequest *req, const char *key);
NATS_EXTERN natsConnection *
microRequest_GetConnection(microRequest *req);
NATS_EXTERN const char *
microRequest_GetData(microRequest *req);
NATS_EXTERN int
microRequest_GetDataLength(microRequest *req);
NATS_EXTERN void *
microRequest_GetEndpointState(microRequest *req);
NATS_EXTERN microError *
microRequest_GetHeaderKeys(microRequest *req, const char ***keys, int *count);
NATS_EXTERN microError *
microRequest_GetHeaderValue(microRequest *req, const char *key, const char **value);
NATS_EXTERN microError *
microRequest_GetHeaderValues(microRequest *req, const char *key, const char ***values, int *count);
NATS_EXTERN natsMsg *
microRequest_GetMsg(microRequest *req);
NATS_EXTERN const char *
microRequest_GetReply(microRequest *req);
NATS_EXTERN microService *
microRequest_GetService(microRequest *req);
NATS_EXTERN void *
microRequest_GetServiceState(microRequest *req);
NATS_EXTERN const char *
microRequest_GetSubject(microRequest *req);
NATS_EXTERN microError *
microRequest_Respond(microRequest *req, const char *data, size_t len);
NATS_EXTERN microError *
microRequest_RespondError(microRequest *req, microError *err);
NATS_EXTERN microError *
microRequest_RespondCustom(microRequest *req, microError *err, const char *data, size_t len);
NATS_EXTERN microError *
microRequest_SetHeader(microRequest *req, const char *key, const char *value);
// end of microRequestFunctions
NATS_EXTERN microError *
micro_Errorf(const char *format, ...);
NATS_EXTERN microError *
micro_ErrorfCode(int code, const char *format, ...);
NATS_EXTERN microError *
micro_ErrorFromStatus(natsStatus s);
NATS_EXTERN int
microError_Code(microError *err);
NATS_EXTERN void
microError_Destroy(microError *err);
#define microError_Ignore(__err) microError_Destroy(__err)
NATS_EXTERN natsStatus
microError_Status(microError *err);
NATS_EXTERN const char *
microError_String(microError *err, char *buf, size_t len);
NATS_EXTERN microError *
microError_Wrapf(microError *err, const char *format, ...);
// end of microErrorFunctions
NATS_EXTERN microError *
micro_NewClient(microClient **new_client, natsConnection *nc, microClientConfig *cfg);
NATS_EXTERN void
microClient_Destroy(microClient *client);
NATS_EXTERN microError *
microClient_DoRequest(natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len);
// end of microClientFunctions
NATS_EXTERN void
microServiceInfo_Destroy(microServiceInfo *info);
NATS_EXTERN void
microServiceStats_Destroy(microServiceStats *stats);
// end of microCleanupFunctions
// end of microFunctions
// end of microGroup
#ifdef __cplusplus
}
#endif
#endif /* NATS_H_ */
natsOnCompleteCB
void(* natsOnCompleteCB)(void *closure)
Callback used to notify that an object lifecycle is complete.
Definition nats.h:1608
natsEvLoop_Attach
natsStatus(* natsEvLoop_Attach)(void **userData, void *loop, natsConnection *nc, natsSock socket)
Attach this connection to the external event loop.
Definition nats.h:1489
natsUserJWTHandler
natsStatus(* natsUserJWTHandler)(char **userJWT, char **customErrTxt, void *closure)
Callback used to fetch and return account signed user JWT.
Definition nats.h:1552
natsEvLoop_WriteAddRemove
natsStatus(* natsEvLoop_WriteAddRemove)(void *userData, bool add)
Write event needs to be added or removed.
Definition nats.h:1517
natsCustomReconnectDelayHandler
int64_t(* natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure)
Callback used to specify how long to wait between reconnects.
Definition nats.h:1630
natsTokenHandler
const char *(* natsTokenHandler)(void *closure)
Callback used to build a token on connections and reconnections.
Definition nats.h:1598
jsPubAckHandler
void(* jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish responses from JetStream.
Definition nats.h:1709
jsPubAckErrHandler
void(* jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish errors from JetStream.
Definition nats.h:1666
natsErrHandler
void(* natsErrHandler)(natsConnection *nc, natsSubscription *subscription, natsStatus err, void *closure)
Callback used to notify the user of errors encountered while processing inbound messages.
Definition nats.h:1472
natsEvLoop_Detach
natsStatus(* natsEvLoop_Detach)(void *userData)
Detach from the event loop.
Definition nats.h:1528
natsSignatureHandler
natsStatus(* natsSignatureHandler)(char **customErrTxt, unsigned char **signature, int *signatureLength, const char *nonce, void *closure)
Callback used to sign a nonce sent by the server.
Definition nats.h:1583
stanConnectionLostHandler
void(* stanConnectionLostHandler)(stanConnection *sc, const char *errorTxt, void *closure)
Callback used to notify the user of the permanent loss of the connection.
Definition nats.h:1741
natsConnectionHandler
void(* natsConnectionHandler)(natsConnection *nc, void *closure)
Callback used to notify the user of asynchronous connection events.
Definition nats.h:1463
natsMsgHandler
void(* natsMsgHandler)(natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition nats.h:1447
stanPubAckHandler
void(* stanPubAckHandler)(const char *guid, const char *error, void *closure)
Callback used to notify of an asynchronous publish result.
Definition nats.h:1721
natsEvLoop_ReadAddRemove
natsStatus(* natsEvLoop_ReadAddRemove)(void *userData, bool add)
Read event needs to be added or removed.
Definition nats.h:1504
stanMsgHandler
void(* stanMsgHandler)(stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition nats.h:1732
natsConnection_Buffered
NATS_EXTERN int natsConnection_Buffered(natsConnection *nc)
Returns the number of bytes to be sent to the server.
natsConnection_IsDraining
bool natsConnection_IsDraining(natsConnection *nc)
Test if connection is draining.
natsConnection_Close
NATS_EXTERN void natsConnection_Close(natsConnection *nc)
Closes the connection.
natsConnection_Flush
NATS_EXTERN natsStatus natsConnection_Flush(natsConnection *nc)
Flushes the connection.
natsConnection_Status
NATS_EXTERN natsConnStatus natsConnection_Status(natsConnection *nc)
Returns the current state of the connection.
natsConnection_GetConnectedServerId
NATS_EXTERN natsStatus natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize)
Gets the server Id.
natsConnection_IsClosed
NATS_EXTERN bool natsConnection_IsClosed(natsConnection *nc)
Test if connection has been closed.
natsConnection_Drain
NATS_EXTERN natsStatus natsConnection_Drain(natsConnection *nc)
Drains the connection with default timeout.
natsConnection_IsReconnecting
NATS_EXTERN bool natsConnection_IsReconnecting(natsConnection *nc)
Test if connection is reconnecting.
natsConnection_GetStats
NATS_EXTERN natsStatus natsConnection_GetStats(natsConnection *nc, natsStatistics *stats)
Gets the connection statistics.
natsConnection_GetMaxPayload
NATS_EXTERN int64_t natsConnection_GetMaxPayload(natsConnection *nc)
Returns the maximum message payload.
natsConnection_Sign
NATS_EXTERN natsStatus natsConnection_Sign(natsConnection *nc, const unsigned char *message, int messageLen, unsigned char sig[64])
Signs any 'message' using the connection's user credentials.
natsConnection_Connect
NATS_EXTERN natsStatus natsConnection_Connect(natsConnection **nc, natsOptions *options)
Connects to a NATS Server using the provided options.
natsConnection_GetClientID
NATS_EXTERN natsStatus natsConnection_GetClientID(natsConnection *nc, uint64_t *cid)
Gets the current client ID assigned by the server.
natsConnection_GetLocalIPAndPort
natsStatus natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port)
Returns the connection local IP and port.
natsConnection_FlushTimeout
NATS_EXTERN natsStatus natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout)
Flushes the connection with a given timeout.
natsConnection_GetRTT
NATS_EXTERN natsStatus natsConnection_GetRTT(natsConnection *nc, int64_t *rtt)
Returns the round trip time between this client and the server.
natsConnection_ProcessReadEvent
NATS_EXTERN void natsConnection_ProcessReadEvent(natsConnection *nc)
Process a read event when using external event loop.
natsConnection_GetLastError
NATS_EXTERN natsStatus natsConnection_GetLastError(natsConnection *nc, const char **lastError)
Gets the last connection error.
natsConnection_GetDiscoveredServers
NATS_EXTERN natsStatus natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count)
Returns the list of discovered server URLs.
natsConnection_HasHeaderSupport
NATS_EXTERN natsStatus natsConnection_HasHeaderSupport(natsConnection *nc)
Returns if the connection to current server supports headers.
natsConnection_ProcessWriteEvent
NATS_EXTERN void natsConnection_ProcessWriteEvent(natsConnection *nc)
Process a write event when using external event loop.
natsConnection_GetClientIP
NATS_EXTERN natsStatus natsConnection_GetClientIP(natsConnection *nc, char **ip)
Returns the client's IP address as reported by the server.
natsConnection_DrainTimeout
NATS_EXTERN natsStatus natsConnection_DrainTimeout(natsConnection *nc, int64_t timeout)
Drains the connection with given timeout.
natsConnection_GetServers
NATS_EXTERN natsStatus natsConnection_GetServers(natsConnection *nc, char ***servers, int *count)
Returns the list of server URLs known to this connection.
natsConnection_GetConnectedUrl
NATS_EXTERN natsStatus natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize)
Gets the URL of the currently connected server.
natsConnection_ConnectTo
NATS_EXTERN natsStatus natsConnection_ConnectTo(natsConnection **nc, const char *urls)
Connects to a NATS Server using any of the URL from the given list.
natsConnection_Destroy
NATS_EXTERN void natsConnection_Destroy(natsConnection *nc)
Destroys the connection object.
natsConnection_RequestMsg
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.
natsConnection_RequestString
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.
natsConnection_PublishMsg
NATS_EXTERN natsStatus natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg)
Publishes a message on a subject.
natsConnection_PublishRequest
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.
natsConnection_PublishRequestString
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.
natsConnection_Publish
NATS_EXTERN natsStatus natsConnection_Publish(natsConnection *nc, const char *subj, const void *data, int dataLen)
Publishes data on a subject.
natsConnection_PublishString
NATS_EXTERN natsStatus natsConnection_PublishString(natsConnection *nc, const char *subj, const char *str)
Publishes a string on a subject.
natsConnection_Request
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.
natsConnection_SubscribeSync
NATS_EXTERN natsStatus natsConnection_SubscribeSync(natsSubscription **sub, natsConnection *nc, const char *subject)
Creates a synchronous subcription.
natsConnection_QueueSubscribe
NATS_EXTERN natsStatus natsConnection_QueueSubscribe(natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous queue subscriber.
natsConnection_QueueSubscribeSync
NATS_EXTERN natsStatus natsConnection_QueueSubscribeSync(natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup)
Creates a synchronous queue subscriber.
natsConnection_QueueSubscribeTimeout
NATS_EXTERN natsStatus natsConnection_QueueSubscribeTimeout(natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup, int64_t timeout, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous queue subscriber with a timeout.
natsConnection_SubscribeTimeout
NATS_EXTERN natsStatus natsConnection_SubscribeTimeout(natsSubscription **sub, natsConnection *nc, const char *subject, int64_t timeout, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous subscription with a timeout.
natsConnection_Subscribe
NATS_EXTERN natsStatus natsConnection_Subscribe(natsSubscription **sub, natsConnection *nc, const char *subject, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous subscription.
natsInbox_Create
NATS_EXTERN natsStatus natsInbox_Create(natsInbox **newInbox)
Creates an inbox.
natsInbox_Destroy
NATS_EXTERN void natsInbox_Destroy(natsInbox *inbox)
Destroys the inbox.
jsPlacement_Init
NATS_EXTERN natsStatus jsPlacement_Init(jsPlacement *placement)
Initializes a placement configuration structure.
jsConsumerNamesList_Destroy
NATS_EXTERN void jsConsumerNamesList_Destroy(jsConsumerNamesList *list)
Destroys the consumer names list object.
js_GetConsumerInfo
NATS_EXTERN natsStatus js_GetConsumerInfo(jsConsumerInfo **ci, jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode)
Retrieves information about a consumer.
jsConsumerConfig_Init
NATS_EXTERN natsStatus jsConsumerConfig_Init(jsConsumerConfig *cc)
Initializes a consumer configuration structure.
jsRePublish_Init
NATS_EXTERN natsStatus jsRePublish_Init(jsRePublish *rp)
Initializes a republish structure.
jsStreamInfoList_Destroy
NATS_EXTERN void jsStreamInfoList_Destroy(jsStreamInfoList *list)
Destroys the stream information list object.
js_DeleteStream
NATS_EXTERN natsStatus js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Deletes a stream.
jsConsumerInfoList_Destroy
NATS_EXTERN void jsConsumerInfoList_Destroy(jsConsumerInfoList *list)
Destroys the consumer information list object.
js_DeleteConsumer
NATS_EXTERN natsStatus js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode)
Deletes a consumer.
js_Streams
NATS_EXTERN natsStatus js_Streams(jsStreamInfoList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available streams.
js_PurgeStream
NATS_EXTERN natsStatus js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Purges a stream.
js_AddStream
NATS_EXTERN natsStatus js_AddStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Creates a stream.
js_DirectGetMsg
NATS_EXTERN natsStatus js_DirectGetMsg(natsMsg **msg, jsCtx *js, const char *stream, jsOptions *opts, jsDirectGetMsgOptions *dgOpts)
Retrieves directly a JetStream message based on provided options.
js_GetLastMsg
NATS_EXTERN natsStatus js_GetLastMsg(natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode)
Retrieves the last JetStream message from the stream for a given subject.
js_ConsumerNames
NATS_EXTERN natsStatus js_ConsumerNames(jsConsumerNamesList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available consumer names for a stream.
js_EraseMsg
NATS_EXTERN natsStatus js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Erases a message from the stream.
js_UpdateStream
NATS_EXTERN natsStatus js_UpdateStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Updates a stream.
jsAccountInfo_Destroy
NATS_EXTERN void jsAccountInfo_Destroy(jsAccountInfo *ai)
Destroys the account information object.
jsStreamSource_Init
NATS_EXTERN natsStatus jsStreamSource_Init(jsStreamSource *source)
Initializes a stream source configuration structure.
jsExternalStream_Init
NATS_EXTERN natsStatus jsExternalStream_Init(jsExternalStream *external)
Initializes an external stream configuration structure.
jsDirectGetMsgOptions_Init
NATS_EXTERN natsStatus jsDirectGetMsgOptions_Init(jsDirectGetMsgOptions *opts)
Initializes a direct get message options structure.
jsStreamInfo_Destroy
NATS_EXTERN void jsStreamInfo_Destroy(jsStreamInfo *si)
Destroys the stream information object.
js_GetStreamInfo
NATS_EXTERN natsStatus js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Retreives information from a stream.
jsConsumerInfo_Destroy
NATS_EXTERN void jsConsumerInfo_Destroy(jsConsumerInfo *ci)
Destroys the consumer information object.
js_GetMsg
NATS_EXTERN natsStatus js_GetMsg(natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Retrieves a JetStream message from the stream by sequence.
jsStreamConfig_Init
NATS_EXTERN natsStatus jsStreamConfig_Init(jsStreamConfig *cfg)
Initializes a streaming configuration structure.
js_StreamNames
NATS_EXTERN natsStatus js_StreamNames(jsStreamNamesList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available stream names.
js_GetAccountInfo
NATS_EXTERN natsStatus js_GetAccountInfo(jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves information about the JetStream usage from an account.
js_UpdateConsumer
NATS_EXTERN natsStatus js_UpdateConsumer(jsConsumerInfo **ci, jsCtx *js, const char *stream, jsConsumerConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Updates a JetStream consumer.
js_DeleteMsg
NATS_EXTERN natsStatus js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Deletes a message from the stream.
js_Consumers
NATS_EXTERN natsStatus js_Consumers(jsConsumerInfoList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available consumers for a stream.
js_AddConsumer
NATS_EXTERN natsStatus js_AddConsumer(jsConsumerInfo **ci, jsCtx *js, const char *stream, jsConsumerConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Adds a JetStream consumer.
jsStreamNamesList_Destroy
NATS_EXTERN void jsStreamNamesList_Destroy(jsStreamNamesList *list)
Destroys the stream names list object.
jsOptions_Init
NATS_EXTERN natsStatus jsOptions_Init(jsOptions *opts)
Initializes a streaming context options structure.
natsConnection_JetStream
NATS_EXTERN natsStatus natsConnection_JetStream(jsCtx **js, natsConnection *nc, jsOptions *opts)
Returns a new JetStream context.
jsCtx_Destroy
NATS_EXTERN void jsCtx_Destroy(jsCtx *js)
Destroys the JetStream context.
natsMsg_GetSequence
NATS_EXTERN uint64_t natsMsg_GetSequence(natsMsg *msg)
Returns the sequence number of this JetStream message.
natsMsg_GetTime
NATS_EXTERN int64_t natsMsg_GetTime(natsMsg *msg)
Returns the timestamp (in UTC) of this JetStream message.
natsMsg_NakWithDelay
NATS_EXTERN natsStatus natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts)
Negatively acknowledges a message.
natsMsg_Nak
NATS_EXTERN natsStatus natsMsg_Nak(natsMsg *msg, jsOptions *opts)
Negatively acknowledges a message.
natsMsg_GetMetaData
NATS_EXTERN natsStatus natsMsg_GetMetaData(jsMsgMetaData **new_meta, natsMsg *msg)
Returns metadata from this JetStream message.
natsMsg_InProgress
NATS_EXTERN natsStatus natsMsg_InProgress(natsMsg *msg, jsOptions *opts)
Resets redelivery timer on the server.
natsMsg_Ack
NATS_EXTERN natsStatus natsMsg_Ack(natsMsg *msg, jsOptions *opts)
Acknowledges a message.
natsMsg_Term
NATS_EXTERN natsStatus natsMsg_Term(natsMsg *msg, jsOptions *opts)
Abandon this message.
jsMsgMetaData_Destroy
NATS_EXTERN void jsMsgMetaData_Destroy(jsMsgMetaData *meta)
Destroys the message metadata object.
natsMsg_AckSync
NATS_EXTERN natsStatus natsMsg_AckSync(natsMsg *msg, jsOptions *opts, jsErrCode *errCode)
Acknowledges a message and wait for a confirmation.
js_PublishAsync
NATS_EXTERN natsStatus js_PublishAsync(jsCtx *js, const char *subj, const void *data, int dataLen, jsPubOptions *opts)
Publishes data to JetStream but does not wait for a jsPubAck.
js_PublishAsyncComplete
NATS_EXTERN natsStatus js_PublishAsyncComplete(jsCtx *js, jsPubOptions *opts)
Wait for all outstanding messages to be acknowledged.
js_PublishAsyncGetPendingList
NATS_EXTERN natsStatus js_PublishAsyncGetPendingList(natsMsgList *pending, jsCtx *js)
Returns the list of pending messages published asynchronously.
js_PublishMsg
NATS_EXTERN natsStatus js_PublishMsg(jsPubAck **pubAck, jsCtx *js, natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode)
Publishes a message to JetStream.
jsPubAck_Destroy
NATS_EXTERN void jsPubAck_Destroy(jsPubAck *pubAck)
Destroys the publish acknowledgment object.
js_PublishMsgAsync
NATS_EXTERN natsStatus js_PublishMsgAsync(jsCtx *js, natsMsg **msg, jsPubOptions *opts)
Publishes a message to JetStream but does not wait for a jsPubAck.
js_Publish
NATS_EXTERN natsStatus js_Publish(jsPubAck **pubAck, jsCtx *js, const char *subj, const void *data, int dataLen, jsPubOptions *opts, jsErrCode *errCode)
Publishes data on a subject to JetStream.
jsPubOptions_Init
NATS_EXTERN natsStatus jsPubOptions_Init(jsPubOptions *opts)
Initializes a publish options structure.
natsSubscription_GetSequenceMismatch
NATS_EXTERN natsStatus natsSubscription_GetSequenceMismatch(jsConsumerSequenceMismatch *csm, natsSubscription *sub)
Returns the consumer sequence mismatch information.
jsFetchRequest_Init
NATS_EXTERN natsStatus jsFetchRequest_Init(jsFetchRequest *request)
Initializes a fetch request options structure.
jsSubOptions_Init
NATS_EXTERN natsStatus jsSubOptions_Init(jsSubOptions *opts)
Initializes a subscribe options structure.
natsSubscription_FetchRequest
NATS_EXTERN natsStatus natsSubscription_FetchRequest(natsMsgList *list, natsSubscription *sub, jsFetchRequest *request)
Fetches messages for a pull subscription with a complete request configuration.
js_Subscribe
NATS_EXTERN natsStatus js_Subscribe(natsSubscription **sub, jsCtx *js, const char *subject, natsMsgHandler cb, void *cbClosure, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create an asynchronous subscription.
natsSubscription_GetConsumerInfo
NATS_EXTERN natsStatus natsSubscription_GetConsumerInfo(jsConsumerInfo **ci, natsSubscription *sub, jsOptions *opts, jsErrCode *errCode)
Returns the jsConsumerInfo associated with this subscription.
js_PullSubscribe
NATS_EXTERN natsStatus js_PullSubscribe(natsSubscription **sub, jsCtx *js, const char *subject, const char *durable, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create a pull subscriber.
js_SubscribeSync
NATS_EXTERN natsStatus js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create a synchronous subscription.
natsSubscription_Fetch
NATS_EXTERN natsStatus natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout, jsErrCode *errCode)
Fetches messages for a pull subscription.
kvEntry_Operation
NATS_EXTERN kvOperation kvEntry_Operation(kvEntry *e)
Returns the type of operation of this value.
kvEntry_Delta
NATS_EXTERN uint64_t kvEntry_Delta(kvEntry *e)
Returns the distance from the latest value.
kvEntry_Value
NATS_EXTERN const void * kvEntry_Value(kvEntry *e)
Returns the value for this key.
kvEntry_Revision
NATS_EXTERN uint64_t kvEntry_Revision(kvEntry *e)
Returns the unique sequence for this value.
kvEntry_Created
NATS_EXTERN int64_t kvEntry_Created(kvEntry *e)
Returns the time (in UTC) the data was put in the bucket.
kvEntry_ValueString
NATS_EXTERN const char * kvEntry_ValueString(kvEntry *e)
Returns the value, as a string, for this key.
kvEntry_Destroy
NATS_EXTERN void kvEntry_Destroy(kvEntry *e)
Destroys the KeyValue entry object.
kvEntry_Key
NATS_EXTERN const char * kvEntry_Key(kvEntry *e)
Returns the name of the key that was retrieved.
kvEntry_Bucket
NATS_EXTERN const char * kvEntry_Bucket(kvEntry *e)
Returns the name of the bucket the data was loaded from.
kvEntry_ValueLen
NATS_EXTERN int kvEntry_ValueLen(kvEntry *e)
Returns the value length for this key.
kvKeysList_Destroy
NATS_EXTERN void kvKeysList_Destroy(kvKeysList *list)
Destroys this list of KeyValue store key strings.
kvStore_UpdateString
NATS_EXTERN natsStatus kvStore_UpdateString(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last)
Updates the value (as a string) for the key into the store if and only if the latest revision matches...
kvStore_Put
NATS_EXTERN natsStatus kvStore_Put(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len)
Places the new value for the key into the store.
kvPurgeOptions_Init
NATS_EXTERN natsStatus kvPurgeOptions_Init(kvPurgeOptions *opts)
Initializes a KeyValue purge options structure.
kvStore_Get
NATS_EXTERN natsStatus kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key)
Returns the latest entry for the key.
kvStore_Watch
NATS_EXTERN natsStatus kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, kvWatchOptions *opts)
Returns a watcher for any updates to keys that match the keys argument.
kvStore_PurgeDeletes
NATS_EXTERN natsStatus kvStore_PurgeDeletes(kvStore *kv, kvPurgeOptions *opts)
Purge and removes delete markers.
kvStore_Purge
NATS_EXTERN natsStatus kvStore_Purge(kvStore *kv, const char *key, kvPurgeOptions *opts)
Deletes a key by placing a purge marker and removing all revisions.
kvStore_Create
NATS_EXTERN natsStatus kvStore_Create(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len)
Places the value for the key into the store if and only if the key does not exist.
kvStore_CreateString
NATS_EXTERN natsStatus kvStore_CreateString(uint64_t *rev, kvStore *kv, const char *key, const char *data)
Places the value (as a string) for the key into the store if and only if the key does not exist.
kvStore_History
NATS_EXTERN natsStatus kvStore_History(kvEntryList *list, kvStore *kv, const char *key, kvWatchOptions *opts)
Returns all historical entries for the key.
kvStore_Keys
NATS_EXTERN natsStatus kvStore_Keys(kvKeysList *list, kvStore *kv, kvWatchOptions *opts)
Returns all keys in the bucket.
kvStore_Delete
NATS_EXTERN natsStatus kvStore_Delete(kvStore *kv, const char *key)
Deletes a key by placing a delete marker and leaving all revisions.
kvWatchOptions_Init
NATS_EXTERN natsStatus kvWatchOptions_Init(kvWatchOptions *opts)
Initializes a KeyValue watcher options structure.
kvStore_PutString
NATS_EXTERN natsStatus kvStore_PutString(uint64_t *rev, kvStore *kv, const char *key, const char *data)
Places the new value (as a string) for the key into the store.
kvStore_GetRevision
NATS_EXTERN natsStatus kvStore_GetRevision(kvEntry **new_entry, kvStore *kv, const char *key, uint64_t revision)
Returns the entry at the specific revision for the key.
kvStore_Bucket
NATS_EXTERN const char * kvStore_Bucket(kvStore *kv)
Returns the bucket name of this KeyValue store object.
kvStore_Status
NATS_EXTERN natsStatus kvStore_Status(kvStatus **new_status, kvStore *kv)
Returns the status and configuration of a bucket.
kvStore_Update
NATS_EXTERN natsStatus kvStore_Update(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last)
Updates the value for the key into the store if and only if the latest revision matches.
kvEntryList_Destroy
NATS_EXTERN void kvEntryList_Destroy(kvEntryList *list)
Destroys this list of KeyValue store entries.
kvStore_WatchAll
NATS_EXTERN natsStatus kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, kvWatchOptions *opts)
Returns a watcher for any updates to any keys of the KeyValue store bucket.
kvConfig_Init
NATS_EXTERN natsStatus kvConfig_Init(kvConfig *cfg)
Initializes a KeyValue configuration structure.
js_KeyValue
NATS_EXTERN natsStatus js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket)
Looks-up and binds to an existing KeyValue store.
js_DeleteKeyValue
NATS_EXTERN natsStatus js_DeleteKeyValue(jsCtx *js, const char *bucket)
Deletes a KeyValue store.
kvStore_Destroy
NATS_EXTERN void kvStore_Destroy(kvStore *kv)
Destroys a KeyValue store object.
js_CreateKeyValue
NATS_EXTERN natsStatus js_CreateKeyValue(kvStore **new_kv, jsCtx *js, kvConfig *cfg)
Creates a KeyValue store with a given configuration.
kvStatus_Bucket
NATS_EXTERN const char * kvStatus_Bucket(kvStatus *sts)
Returns the bucket name.
kvStatus_Values
NATS_EXTERN uint64_t kvStatus_Values(kvStatus *sts)
Returns how many messages are in the bucket, including historical values.
kvStatus_Destroy
NATS_EXTERN void kvStatus_Destroy(kvStatus *sts)
Destroys the KeyValue status object.
kvStatus_Bytes
NATS_EXTERN uint64_t kvStatus_Bytes(kvStatus *sts)
Returns the size (in bytes) of this bucket.
kvStatus_Replicas
NATS_EXTERN int64_t kvStatus_Replicas(kvStatus *sts)
Returns the number of replicas to keep for a bucket.
kvStatus_TTL
NATS_EXTERN int64_t kvStatus_TTL(kvStatus *sts)
Returns how long the bucket keeps values for.
kvStatus_History
NATS_EXTERN int64_t kvStatus_History(kvStatus *sts)
Returns the configured history kept per key.
kvWatcher_Destroy
NATS_EXTERN void kvWatcher_Destroy(kvWatcher *w)
Destroys the KeyValue watcher object.
kvWatcher_Next
NATS_EXTERN natsStatus kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout)
Returns the next entry for this watcher.
kvWatcher_Stop
NATS_EXTERN natsStatus kvWatcher_Stop(kvWatcher *w)
Stops the watcher.
nats_GetVersion
NATS_EXTERN const char * nats_GetVersion(void)
Returns the Library's version.
nats_Open
NATS_EXTERN natsStatus nats_Open(int64_t lockSpinCount)
Initializes the library.
nats_PrintLastErrorStack
NATS_EXTERN void nats_PrintLastErrorStack(FILE *file)
Prints the calling thread's last known error stack into the file.
nats_GetVersionNumber
NATS_EXTERN uint32_t nats_GetVersionNumber(void)
Returns the Library's version as a number.
nats_CheckCompatibility
NATS_EXTERN bool nats_CheckCompatibility(void)
Check that the header is compatible with the library.
nats_Now
NATS_EXTERN int64_t nats_Now(void)
Gives the current time in milliseconds.
nats_SetMessageDeliveryPoolSize
NATS_EXTERN natsStatus nats_SetMessageDeliveryPoolSize(int max)
Sets the maximum size of the global message delivery thread pool.
nats_GetLastErrorStack
NATS_EXTERN natsStatus nats_GetLastErrorStack(char *buffer, size_t bufLen)
Returns the calling thread's last known error stack.
nats_NowInNanoSeconds
NATS_EXTERN int64_t nats_NowInNanoSeconds(void)
Gives the current time in nanoseconds.
nats_Sleep
NATS_EXTERN void nats_Sleep(int64_t sleepTime)
Sleeps for a given number of milliseconds.
nats_GetLastError
NATS_EXTERN const char * nats_GetLastError(natsStatus *status)
Returns the calling thread's last known error.
nats_Close
NATS_EXTERN void nats_Close(void)
Tear down the library.
nats_CloseAndWait
NATS_EXTERN natsStatus nats_CloseAndWait(int64_t timeout)
Tear down the library and wait for all resources to be released.
nats_Sign
NATS_EXTERN natsStatus nats_Sign(const char *encodedSeed, const char *input, unsigned char **signature, int *signatureLength)
Signs a given text using the provided private key.
nats_ReleaseThreadMemory
NATS_EXTERN void nats_ReleaseThreadMemory(void)
Release thread-local memory possibly allocated by the library.
microErrorHandler
void(* microErrorHandler)(microService *m, microEndpoint *ep, natsStatus s)
Callback type for async error notifications.
Definition nats.h:7409
microRequestHandler
microError *(* microRequestHandler)(microRequest *req)
Callback type for request processing.
Definition nats.h:7385
microDoneHandler
void(* microDoneHandler)(microService *m)
Callback type for Done (service stopped) notifications.
Definition nats.h:7422
microServiceInfo_Destroy
NATS_EXTERN void microServiceInfo_Destroy(microServiceInfo *info)
Destroys a microServiceInfo object.
microServiceStats_Destroy
NATS_EXTERN void microServiceStats_Destroy(microServiceStats *stats)
Destroys a microServiceStats object.
micro_NewClient
NATS_EXTERN microError * micro_NewClient(microClient **new_client, natsConnection *nc, microClientConfig *cfg)
Creates a new microservice client.
microClient_Destroy
NATS_EXTERN void microClient_Destroy(microClient *client)
Destroys a microservice client.
microClient_DoRequest
NATS_EXTERN microError * microClient_DoRequest(natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len)
Sends a request to a microservice and receives the response.
microError_Destroy
NATS_EXTERN void microError_Destroy(microError *err)
destroys a microError.
microError_Status
NATS_EXTERN natsStatus microError_Status(microError *err)
Returns the NATS status associated with the error.
microError_Code
NATS_EXTERN int microError_Code(microError *err)
returns the int code of the error.
micro_Errorf
NATS_EXTERN microError * micro_Errorf(const char *format,...)
creates a new microError, with a printf-like formatted message.
micro_ErrorfCode
NATS_EXTERN microError * micro_ErrorfCode(int code, const char *format,...)
creates a new microError, with a code and a printf-like formatted message.
microError_String
NATS_EXTERN const char * microError_String(microError *err, char *buf, size_t len)
Returns a printable string with the error message.
micro_ErrorFromStatus
NATS_EXTERN microError * micro_ErrorFromStatus(natsStatus s)
Wraps a NATS status into a microError, if not a NATS_OK.
microError_Wrapf
NATS_EXTERN microError * microError_Wrapf(microError *err, const char *format,...)
Wraps an exising microError with a higher printf-like formatted message.
microGroup_AddGroup
NATS_EXTERN microError * microGroup_AddGroup(microGroup **new_group, microGroup *parent, const char *prefix)
Adds a sub-group to microGroup.
microGroup_AddEndpoint
NATS_EXTERN microError * microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config)
Adds an endpoint to a microGroup and starts listening for messages.
microRequest_GetService
NATS_EXTERN microService * microRequest_GetService(microRequest *req)
Returns the pointer to the microservice associated with the request.
microRequest_GetDataLength
NATS_EXTERN int microRequest_GetDataLength(microRequest *req)
Returns the number of data bytes in the the request.
microRequest_RespondError
NATS_EXTERN microError * microRequest_RespondError(microRequest *req, microError *err)
Respond to a request with a simple error.
microRequest_GetSubject
NATS_EXTERN const char * microRequest_GetSubject(microRequest *req)
Returns the subject of the request message.
microRequest_GetData
NATS_EXTERN const char * microRequest_GetData(microRequest *req)
Returns the data in the the request, as a byte array.
microRequest_AddHeader
NATS_EXTERN microError * microRequest_AddHeader(microRequest *req, const char *key, const char *value)
Adds a header to the underlying NATS request message.
microRequest_GetConnection
NATS_EXTERN natsConnection * microRequest_GetConnection(microRequest *req)
Returns the connection associated with the request.
microRequest_GetMsg
NATS_EXTERN natsMsg * microRequest_GetMsg(microRequest *req)
Get the NATS message underlying the request.
microRequest_GetServiceState
NATS_EXTERN void * microRequest_GetServiceState(microRequest *req)
Returns the pointer to the user-provided service state.
microRequest_Respond
NATS_EXTERN microError * microRequest_Respond(microRequest *req, const char *data, size_t len)
Respond to a request, on the same NATS connection.
microRequest_GetHeaderKeys
NATS_EXTERN microError * microRequest_GetHeaderKeys(microRequest *req, const char ***keys, int *count)
Gets the list of all header keys in the NATS message underlying the request.
microRequest_SetHeader
NATS_EXTERN microError * microRequest_SetHeader(microRequest *req, const char *key, const char *value)
Add value to the header associated with key in the NATS message underlying the request.
microRequest_GetEndpointState
NATS_EXTERN void * microRequest_GetEndpointState(microRequest *req)
Returns the pointer to the user-provided endpoint state, if the request is associated with an endpoin...
microRequest_GetHeaderValue
NATS_EXTERN microError * microRequest_GetHeaderValue(microRequest *req, const char *key, const char **value)
Get the header entry associated with key from the NATS message underlying the request.
microRequest_DeleteHeader
NATS_EXTERN microError * microRequest_DeleteHeader(microRequest *req, const char *key)
Deletes a header from the underlying NATS request message.
microRequest_GetHeaderValues
NATS_EXTERN microError * microRequest_GetHeaderValues(microRequest *req, const char *key, const char ***values, int *count)
Get all header values associated with key from the NATS message underlying the request.
microRequest_RespondCustom
NATS_EXTERN microError * microRequest_RespondCustom(microRequest *req, microError *err, const char *data, size_t len)
Respond to a message, with an OK or an error.
microRequest_GetReply
NATS_EXTERN const char * microRequest_GetReply(microRequest *req)
Returns the reply subject set in this message.
microService_GetStats
NATS_EXTERN microError * microService_GetStats(microServiceStats **new_stats, microService *m)
Returns run-time statistics for a microservice.
microService_GetConnection
NATS_EXTERN natsConnection * microService_GetConnection(microService *m)
Returns the connection associated with the service. If the service was successfully started,...
micro_AddService
NATS_EXTERN microError * micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config)
Creates and starts a new microservice.
microService_Destroy
NATS_EXTERN microError * microService_Destroy(microService *m)
Destroys a microservice, stopping it first if needed.
microService_Stop
NATS_EXTERN microError * microService_Stop(microService *m)
Stops a running microservice.
microService_AddGroup
NATS_EXTERN microError * microService_AddGroup(microGroup **new_group, microService *m, const char *prefix)
Adds an group (prefix) to a microservice.
microService_IsStopped
NATS_EXTERN bool microService_IsStopped(microService *m)
Checks if the service is stopped.
microService_AddEndpoint
NATS_EXTERN microError * microService_AddEndpoint(microService *m, microEndpointConfig *config)
Adds an endpoint to a microservice and starts listening for messages.
microService_GetInfo
NATS_EXTERN microError * microService_GetInfo(microServiceInfo **new_info, microService *m)
Returns a microServiceInfo for a microservice.
microService_Run
NATS_EXTERN microError * microService_Run(microService *m)
Waits for a microservice to stop.
microService_GetState
NATS_EXTERN void * microService_GetState(microService *m)
Returns the pointer to state data (closure). It is originally provided in microServiceConfig....
microClient
struct micro_client_s microClient
The Microservice client.
Definition nats.h:7244
microGroup
struct micro_group_s microGroup
a collection of endpoints and other groups, with a common prefix to their subjects and names.
Definition nats.h:7313
microRequest
struct micro_request_s microRequest
a request received by a microservice endpoint.
Definition nats.h:7320
microError
struct micro_error_s microError
the Microservice error object.
Definition nats.h:7304
microClientConfig
struct __for_forward_compatibility_only microClientConfig
The Microservice configuration object. For forward compatibility only.
Definition nats.h:7249
microEndpoint
struct micro_endpoint_s microEndpoint
microEndpoint represents a microservice endpoint.
Definition nats.h:7260
microService
struct micro_service_s microService
the main object for a configured microservice.
Definition nats.h:7333
natsMsg_Create
NATS_EXTERN natsStatus natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply, const char *data, int dataLen)
Creates a natsMsg object.
natsMsgList_Destroy
NATS_EXTERN void natsMsgList_Destroy(natsMsgList *list)
Destroys this list of messages.
natsMsg_GetDataLength
NATS_EXTERN int natsMsg_GetDataLength(const natsMsg *msg)
Returns the message length.
natsMsgHeader_Add
NATS_EXTERN natsStatus natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value)
Add value to the header associated with key.
natsMsg_IsNoResponders
NATS_EXTERN bool natsMsg_IsNoResponders(natsMsg *msg)
Indicates if this message is a "no responders" message from the server.
natsMsg_GetData
NATS_EXTERN const char * natsMsg_GetData(const natsMsg *msg)
Returns the message payload.
natsMsgHeader_Keys
NATS_EXTERN natsStatus natsMsgHeader_Keys(natsMsg *msg, const char ***keys, int *count)
Get all header keys.
natsMsg_GetReply
NATS_EXTERN const char * natsMsg_GetReply(const natsMsg *msg)
Returns the reply set in this message.
natsMsg_Destroy
NATS_EXTERN void natsMsg_Destroy(natsMsg *msg)
Destroys the message object.
natsMsgHeader_Get
NATS_EXTERN natsStatus natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value)
Get the header entry associated with key.
natsMsgHeader_Delete
NATS_EXTERN natsStatus natsMsgHeader_Delete(natsMsg *msg, const char *key)
Delete the value(s) associated with key.
natsMsg_GetSubject
NATS_EXTERN const char * natsMsg_GetSubject(const natsMsg *msg)
Returns the subject set in this message.
natsMsgHeader_Values
NATS_EXTERN natsStatus natsMsgHeader_Values(natsMsg *msg, const char *key, const char ***values, int *count)
Get all header values associated with key.
natsMsgHeader_Set
NATS_EXTERN natsStatus natsMsgHeader_Set(natsMsg *msg, const char *key, const char *value)
Set the header entries associated with key to the single element value.
natsOptions_SetNKey
NATS_EXTERN natsStatus natsOptions_SetNKey(natsOptions *opts, const char *pubKey, natsSignatureHandler sigCB, void *sigClosure)
Sets the NKey public key and signature callback.
natsOptions_SetExpectedHostname
NATS_EXTERN natsStatus natsOptions_SetExpectedHostname(natsOptions *opts, const char *hostname)
Sets the server certificate's expected hostname.
natsOptions_SetErrorHandler
NATS_EXTERN natsStatus natsOptions_SetErrorHandler(natsOptions *opts, natsErrHandler errHandler, void *closure)
Sets the error handler for asynchronous events.
natsOptions_SetTimeout
NATS_EXTERN natsStatus natsOptions_SetTimeout(natsOptions *opts, int64_t timeout)
Sets the (re)connect process timeout.
natsOptions_DisableNoResponders
NATS_EXTERN natsStatus natsOptions_DisableNoResponders(natsOptions *opts, bool disabled)
Enable/Disable the "no responders" feature.
natsOptions_SetIOBufSize
NATS_EXTERN natsStatus natsOptions_SetIOBufSize(natsOptions *opts, int ioBufSize)
Sets the size of the internal read/write buffers.
natsOptions_SetName
NATS_EXTERN natsStatus natsOptions_SetName(natsOptions *opts, const char *name)
Sets the name.
natsOptions_SetRetryOnFailedConnect
NATS_EXTERN natsStatus natsOptions_SetRetryOnFailedConnect(natsOptions *opts, bool retry, natsConnectionHandler connectedCb, void *closure)
Indicates if initial connect failure should be retried or not.
natsOptions_SetTokenHandler
NATS_EXTERN natsStatus natsOptions_SetTokenHandler(natsOptions *opts, natsTokenHandler tokenCb, void *closure)
Sets the tokenCb to use whenever a token is needed.
natsOptions_SetReconnectedCB
NATS_EXTERN natsStatus natsOptions_SetReconnectedCB(natsOptions *opts, natsConnectionHandler reconnectedCb, void *closure)
Sets the callback to be invoked when the connection has reconnected.
natsOptions_SetPedantic
NATS_EXTERN natsStatus natsOptions_SetPedantic(natsOptions *opts, bool pedantic)
Sets the pedantic mode.
natsOptions_SetReconnectWait
NATS_EXTERN natsStatus natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait)
Sets the time between reconnect attempts.
natsOptions_SetCipherSuites
NATS_EXTERN natsStatus natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers)
Sets the list of available ciphers for TLSv1.3.
natsOptions_LoadCATrustedCertificates
NATS_EXTERN natsStatus natsOptions_LoadCATrustedCertificates(natsOptions *opts, const char *fileName)
Loads the trusted CA certificates from a file.
natsOptions_SetCustomReconnectDelay
NATS_EXTERN natsStatus natsOptions_SetCustomReconnectDelay(natsOptions *opts, natsCustomReconnectDelayHandler cb, void *closure)
Sets the handler to invoke when the library needs to wait before the next reconnect attempts.
natsOptions_LoadCertificatesChain
NATS_EXTERN natsStatus natsOptions_LoadCertificatesChain(natsOptions *opts, const char *certsFileName, const char *keyFileName)
Loads the certificate chain from a file, using the given key.
natsOptions_SetAllowReconnect
NATS_EXTERN natsStatus natsOptions_SetAllowReconnect(natsOptions *opts, bool allow)
Indicates if the connection will be allowed to reconnect.
natsOptions_SetURL
NATS_EXTERN natsStatus natsOptions_SetURL(natsOptions *opts, const char *url)
Sets the URL to connect to.
natsOptions_SetClosedCB
NATS_EXTERN natsStatus natsOptions_SetClosedCB(natsOptions *opts, natsConnectionHandler closedCb, void *closure)
Sets the callback to be invoked when a connection to a server is permanently lost.
natsOptions_SetNoEcho
NATS_EXTERN natsStatus natsOptions_SetNoEcho(natsOptions *opts, bool noEcho)
Sets if connection receives its own messages.
natsOptions_SetLameDuckModeCB
NATS_EXTERN natsStatus natsOptions_SetLameDuckModeCB(natsOptions *opts, natsConnectionHandler lameDuckCb, void *closure)
Sets the callback to be invoked when server enters lame duck mode.
natsOptions_SetCiphers
NATS_EXTERN natsStatus natsOptions_SetCiphers(natsOptions *opts, const char *ciphers)
Sets the list of available ciphers.
natsOptions_SetUserCredentialsFromFiles
NATS_EXTERN natsStatus natsOptions_SetUserCredentialsFromFiles(natsOptions *opts, const char *userOrChainedFile, const char *seedFile)
Sets the file(s) to use to fetch user JWT and seed required to sign nonce.
natsOptions_SetMessageBufferPadding
NATS_EXTERN natsStatus natsOptions_SetMessageBufferPadding(natsOptions *opts, int paddingSize)
Sets a custom padding when allocating buffer for incoming messages.
natsOptions_SetUserInfo
NATS_EXTERN natsStatus natsOptions_SetUserInfo(natsOptions *opts, const char *user, const char *password)
Sets the user name/password to use when not specified in the URL.
natsOptions_SetUserCredentialsFromMemory
NATS_EXTERN natsStatus natsOptions_SetUserCredentialsFromMemory(natsOptions *opts, const char *jwtAndSeedContent)
Sets JWT handler and handler to sign nonce that uses seed.
natsOptions_SetUserCredentialsCallbacks
NATS_EXTERN natsStatus natsOptions_SetUserCredentialsCallbacks(natsOptions *opts, natsUserJWTHandler ujwtCB, void *ujwtClosure, natsSignatureHandler sigCB, void *sigClosure)
Sets the callbacks to fetch user JWT and sign server's nonce.
natsOptions_Create
NATS_EXTERN natsStatus natsOptions_Create(natsOptions **newOpts)
Creates a natsOptions object.
natsOptions_SetNKeyFromSeed
NATS_EXTERN natsStatus natsOptions_SetNKeyFromSeed(natsOptions *opts, const char *pubKey, const char *seedFile)
Sets the NKey public key and its seed file.
natsOptions_SkipServerVerification
NATS_EXTERN natsStatus natsOptions_SkipServerVerification(natsOptions *opts, bool skip)
Switch server certificate verification.
natsOptions_UseOldRequestStyle
NATS_EXTERN natsStatus natsOptions_UseOldRequestStyle(natsOptions *opts, bool useOldStyle)
Switches the use of old style requests.
natsOptions_IPResolutionOrder
NATS_EXTERN natsStatus natsOptions_IPResolutionOrder(natsOptions *opts, int order)
Dictates the order in which host name are resolved during connect.
natsOptions_SetIgnoreDiscoveredServers
NATS_EXTERN natsStatus natsOptions_SetIgnoreDiscoveredServers(natsOptions *opts, bool ignore)
Sets if the library should ignore or not discovered servers.
natsOptions_SetSendAsap
NATS_EXTERN natsStatus natsOptions_SetSendAsap(natsOptions *opts, bool sendAsap)
Sets if Publish calls should send data right away.
natsOptions_SetReconnectJitter
NATS_EXTERN natsStatus natsOptions_SetReconnectJitter(natsOptions *opts, int64_t jitter, int64_t jitterTLS)
Set the upper bound of a random delay added to reconnect wait.
natsOptions_Destroy
NATS_EXTERN void natsOptions_Destroy(natsOptions *opts)
Destroys a natsOptions object.
natsOptions_SetMaxPendingMsgs
NATS_EXTERN natsStatus natsOptions_SetMaxPendingMsgs(natsOptions *opts, int maxPending)
Sets the maximum number of pending messages per subscription.
natsOptions_SetReconnectBufSize
NATS_EXTERN natsStatus natsOptions_SetReconnectBufSize(natsOptions *opts, int reconnectBufSize)
Sets the size of the backing buffer used during reconnect.
natsOptions_SetVerbose
NATS_EXTERN natsStatus natsOptions_SetVerbose(natsOptions *opts, bool verbose)
Sets the verbose mode.
natsOptions_SetSecure
NATS_EXTERN natsStatus natsOptions_SetSecure(natsOptions *opts, bool secure)
Sets the secure mode.
natsOptions_SetNoRandomize
NATS_EXTERN natsStatus natsOptions_SetNoRandomize(natsOptions *opts, bool noRandomize)
Indicate if the servers list should be randomized.
natsOptions_SetWriteDeadline
NATS_EXTERN natsStatus natsOptions_SetWriteDeadline(natsOptions *opts, int64_t deadline)
Sets the write deadline.
natsOptions_SetMaxPingsOut
NATS_EXTERN natsStatus natsOptions_SetMaxPingsOut(natsOptions *opts, int maxPingsOut)
Sets the limit of outstanding PINGs without corresponding PONGs.
natsOptions_SetEventLoop
NATS_EXTERN natsStatus natsOptions_SetEventLoop(natsOptions *opts, void *loop, natsEvLoop_Attach attachCb, natsEvLoop_ReadAddRemove readCb, natsEvLoop_WriteAddRemove writeCb, natsEvLoop_Detach detachCb)
Sets the external event loop and associated callbacks.
natsOptions_SetMaxReconnect
NATS_EXTERN natsStatus natsOptions_SetMaxReconnect(natsOptions *opts, int maxReconnect)
Sets the maximum number of reconnect attempts.
natsOptions_SetDiscoveredServersCB
NATS_EXTERN natsStatus natsOptions_SetDiscoveredServersCB(natsOptions *opts, natsConnectionHandler discoveredServersCb, void *closure)
Sets the callback to be invoked when new servers are discovered.
natsOptions_UseGlobalMessageDelivery
NATS_EXTERN natsStatus natsOptions_UseGlobalMessageDelivery(natsOptions *opts, bool global)
Switch on/off the use of a central message delivery thread pool.
natsOptions_SetCustomInboxPrefix
NATS_EXTERN natsStatus natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix)
Sets a custom inbox prefix.
natsOptions_SetServers
NATS_EXTERN natsStatus natsOptions_SetServers(natsOptions *opts, const char **servers, int serversCount)
Set the list of servers to try to (re)connect to.
natsOptions_SetToken
NATS_EXTERN natsStatus natsOptions_SetToken(natsOptions *opts, const char *token)
Sets the token to use when not specified in the URL.
natsOptions_SetDisconnectedCB
NATS_EXTERN natsStatus natsOptions_SetDisconnectedCB(natsOptions *opts, natsConnectionHandler disconnectedCb, void *closure)
Sets the callback to be invoked when the connection to a server is lost.
natsOptions_SetFailRequestsOnDisconnect
NATS_EXTERN natsStatus natsOptions_SetFailRequestsOnDisconnect(natsOptions *opts, bool failRequests)
Fails pending requests on disconnect event.
natsOptions_SetPingInterval
NATS_EXTERN natsStatus natsOptions_SetPingInterval(natsOptions *opts, int64_t interval)
Sets the ping interval.
natsOptions_SetCertificatesChain
NATS_EXTERN natsStatus natsOptions_SetCertificatesChain(natsOptions *opts, const char *cert, const char *key)
Sets the client certificate and key.
natsOptions_SetCATrustedCertificates
NATS_EXTERN natsStatus natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates)
Sets the trusted CA certificates from memory.
stanConnection_GetNATSConnection
NATS_EXTERN natsStatus stanConnection_GetNATSConnection(stanConnection *sc, natsConnection **nc)
Returns the underlying NATS Connection.
stanConnection_ReleaseNATSConnection
NATS_EXTERN void stanConnection_ReleaseNATSConnection(stanConnection *sc)
Releases the NATS Connection.
stanConnection_Connect
NATS_EXTERN natsStatus stanConnection_Connect(stanConnection **sc, const char *clusterID, const char *clientID, stanConnOptions *options)
Connects to a NATS Streaming Server using the provided options.
stanConnection_Close
NATS_EXTERN natsStatus stanConnection_Close(stanConnection *sc)
Closes the connection.
stanConnection_Destroy
NATS_EXTERN natsStatus stanConnection_Destroy(stanConnection *sc)
Destroys the connection object.
stanConnOptions_SetDiscoveryPrefix
NATS_EXTERN natsStatus stanConnOptions_SetDiscoveryPrefix(stanConnOptions *opts, const char *prefix)
Sets the subject prefix the library sends the connect request to.
stanConnOptions_SetConnectionLostHandler
NATS_EXTERN natsStatus stanConnOptions_SetConnectionLostHandler(stanConnOptions *opts, stanConnectionLostHandler handler, void *closure)
Sets the connection lost handler.
stanConnOptions_SetMaxPubAcksInflight
NATS_EXTERN natsStatus stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage)
Sets the maximum number of published messages without outstanding ACKs from the server.
stanConnOptions_SetPubAckWait
NATS_EXTERN natsStatus stanConnOptions_SetPubAckWait(stanConnOptions *opts, int64_t wait)
Sets the timeout for waiting for an ACK for a published message.
stanConnOptions_SetURL
NATS_EXTERN natsStatus stanConnOptions_SetURL(stanConnOptions *opts, const char *url)
Sets the URL to connect to.
stanConnOptions_SetConnectionWait
NATS_EXTERN natsStatus stanConnOptions_SetConnectionWait(stanConnOptions *opts, int64_t wait)
Sets the timeout for establishing a connection.
stanConnOptions_Destroy
NATS_EXTERN void stanConnOptions_Destroy(stanConnOptions *opts)
Destroys a stanConnOptions object.
stanConnOptions_SetPings
NATS_EXTERN natsStatus stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut)
Sets the ping interval and max out values.
stanConnOptions_SetNATSOptions
NATS_EXTERN natsStatus stanConnOptions_SetNATSOptions(stanConnOptions *opts, natsOptions *nOpts)
Sets the NATS Options to use to create the connection.
stanConnOptions_Create
NATS_EXTERN natsStatus stanConnOptions_Create(stanConnOptions **newOpts)
Creates a stanConnOptions object.
stanConnection_PublishAsync
NATS_EXTERN natsStatus stanConnection_PublishAsync(stanConnection *sc, const char *channel, const void *data, int dataLen, stanPubAckHandler ah, void *ahClosure)
Asynchronously publishes data on a channel.
stanConnection_Publish
NATS_EXTERN natsStatus stanConnection_Publish(stanConnection *sc, const char *channel, const void *data, int dataLen)
Publishes data on a channel.
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 subscription.
stanConnection_Subscribe
NATS_EXTERN natsStatus stanConnection_Subscribe(stanSubscription **sub, stanConnection *sc, const char *channel, stanMsgHandler cb, void *cbClosure, stanSubOptions *options)
Creates a subscription.
stanMsg_GetData
NATS_EXTERN const char * stanMsg_GetData(const stanMsg *msg)
Returns the message payload.
stanMsg_GetTimestamp
NATS_EXTERN int64_t stanMsg_GetTimestamp(const stanMsg *msg)
Returns the message's timestamp.
stanMsg_GetDataLength
NATS_EXTERN int stanMsg_GetDataLength(const stanMsg *msg)
Returns the message length.
stanMsg_IsRedelivered
NATS_EXTERN bool stanMsg_IsRedelivered(const stanMsg *msg)
Returns the message's redelivered flag.
stanMsg_GetSequence
NATS_EXTERN uint64_t stanMsg_GetSequence(const stanMsg *msg)
Returns the message's sequence number.
stanMsg_Destroy
NATS_EXTERN void stanMsg_Destroy(stanMsg *msg)
Destroys the message object.
stanSubscription_AckMsg
NATS_EXTERN natsStatus stanSubscription_AckMsg(stanSubscription *sub, stanMsg *msg)
Acknowledge a message.
stanSubscription_Destroy
NATS_EXTERN void stanSubscription_Destroy(stanSubscription *sub)
Destroys the subscription.
stanSubscription_SetOnCompleteCB
NATS_EXTERN natsStatus stanSubscription_SetOnCompleteCB(stanSubscription *sub, natsOnCompleteCB cb, void *closure)
Sets a completion callback.
stanSubscription_Close
NATS_EXTERN natsStatus stanSubscription_Close(stanSubscription *sub)
Closes the subscription.
stanSubscription_Unsubscribe
NATS_EXTERN natsStatus stanSubscription_Unsubscribe(stanSubscription *sub)
Permanently remove a subscription.
stanSubOptions_Destroy
NATS_EXTERN void stanSubOptions_Destroy(stanSubOptions *opts)
Destroys a stanSubOptions object.
stanSubOptions_StartAtTimeDelta
NATS_EXTERN natsStatus stanSubOptions_StartAtTimeDelta(stanSubOptions *opts, int64_t delta)
Sets the desired start position based on the given delta.
stanSubOptions_SetMaxInflight
NATS_EXTERN natsStatus stanSubOptions_SetMaxInflight(stanSubOptions *opts, int maxInflight)
Sets the the maximum number of messages the cluster will send without an ACK.
stanSubOptions_StartAtSequence
NATS_EXTERN natsStatus stanSubOptions_StartAtSequence(stanSubOptions *opts, uint64_t seq)
Sets the desired start position based on the given sequence number.
stanSubOptions_SetManualAckMode
NATS_EXTERN natsStatus stanSubOptions_SetManualAckMode(stanSubOptions *opts, bool manual)
Sets the subscription's acknowledgment mode.
stanSubOptions_StartWithLastReceived
NATS_EXTERN natsStatus stanSubOptions_StartWithLastReceived(stanSubOptions *opts)
The subscription should start with the last message in the channel.
stanSubOptions_SetDurableName
NATS_EXTERN natsStatus stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName)
Sets the Durable Name for this subscription.
stanSubOptions_StartAtTime
NATS_EXTERN natsStatus stanSubOptions_StartAtTime(stanSubOptions *opts, int64_t time)
Sets the desired start position based on the given time.
stanSubOptions_DeliverAllAvailable
NATS_EXTERN natsStatus stanSubOptions_DeliverAllAvailable(stanSubOptions *opts)
The subscription should start with the first message in the channel.
stanSubOptions_Create
NATS_EXTERN natsStatus stanSubOptions_Create(stanSubOptions **newOpts)
Creates a stanSubOptions object.
stanSubOptions_SetAckWait
NATS_EXTERN natsStatus stanSubOptions_SetAckWait(stanSubOptions *opts, int64_t wait)
Sets the timeout for waiting for an ACK from the cluster's point of view for delivered messages.
natsStatistics_Destroy
NATS_EXTERN void natsStatistics_Destroy(natsStatistics *stats)
Destroys the natsStatistics object.
natsStatistics_GetCounts
NATS_EXTERN natsStatus natsStatistics_GetCounts(const natsStatistics *stats, uint64_t *inMsgs, uint64_t *inBytes, uint64_t *outMsgs, uint64_t *outBytes, uint64_t *reconnects)
Extracts the various statistics values.
natsStatistics_Create
NATS_EXTERN natsStatus natsStatistics_Create(natsStatistics **newStats)
Creates a natsStatistics object.
natsStatus_GetText
NATS_EXTERN const char * natsStatus_GetText(natsStatus s)
Get the text corresponding to a natsStatus.
natsSubscription_WaitForDrainCompletion
NATS_EXTERN natsStatus natsSubscription_WaitForDrainCompletion(natsSubscription *sub, int64_t timeout)
Blocks until the drain operation completes.
natsSubscription_AutoUnsubscribe
NATS_EXTERN natsStatus natsSubscription_AutoUnsubscribe(natsSubscription *sub, int max)
Auto-Unsubscribes.
natsSubscription_GetMaxPending
NATS_EXTERN natsStatus natsSubscription_GetMaxPending(natsSubscription *sub, int *msgs, int *bytes)
Returns the maximum number of pending messages and bytes.
natsSubscription_GetStats
NATS_EXTERN natsStatus natsSubscription_GetStats(natsSubscription *sub, int *pendingMsgs, int *pendingBytes, int *maxPendingMsgs, int *maxPendingBytes, int64_t *deliveredMsgs, int64_t *droppedMsgs)
Get various statistics from this subscription.
natsSubscription_GetDropped
NATS_EXTERN natsStatus natsSubscription_GetDropped(natsSubscription *sub, int64_t *msgs)
Returns the number of dropped messages.
natsSubscription_Drain
NATS_EXTERN natsStatus natsSubscription_Drain(natsSubscription *sub)
Drains the subscription with a default timeout.
natsSubscription_NoDeliveryDelay
NATS_EXTERN natsStatus natsSubscription_NoDeliveryDelay(natsSubscription *sub)
Enables the No Delivery Delay mode.
natsSubscription_GetDelivered
NATS_EXTERN natsStatus natsSubscription_GetDelivered(natsSubscription *sub, int64_t *msgs)
Returns the number of delivered messages.
natsSubscription_Destroy
NATS_EXTERN void natsSubscription_Destroy(natsSubscription *sub)
Destroys the subscription.
natsSubscription_GetID
NATS_EXTERN int64_t natsSubscription_GetID(natsSubscription *sub)
Gets the subscription id.
natsSubscription_IsValid
NATS_EXTERN bool natsSubscription_IsValid(natsSubscription *sub)
Checks the validity of the subscription.
natsSubscription_NextMsg
NATS_EXTERN natsStatus natsSubscription_NextMsg(natsMsg **nextMsg, natsSubscription *sub, int64_t timeout)
Returns the next available message.
natsSubscription_SetPendingLimits
NATS_EXTERN natsStatus natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit)
Sets the limit for pending messages and bytes.
natsSubscription_GetPendingLimits
NATS_EXTERN natsStatus natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit)
Returns the current limit for pending messages and bytes.
natsSubscription_QueuedMsgs
NATS_EXTERN natsStatus natsSubscription_QueuedMsgs(natsSubscription *sub, uint64_t *queuedMsgs)
Gets the number of pending messages.
natsSubscription_DrainCompletionStatus
NATS_EXTERN natsStatus natsSubscription_DrainCompletionStatus(natsSubscription *sub)
Returns the status of the drain after completion.
natsSubscription_DrainTimeout
NATS_EXTERN natsStatus natsSubscription_DrainTimeout(natsSubscription *sub, int64_t timeout)
Drains the subscription with the specified timeout.
natsSubscription_GetPending
NATS_EXTERN natsStatus natsSubscription_GetPending(natsSubscription *sub, int *msgs, int *bytes)
Returns the number of pending messages and bytes.
natsSubscription_GetSubject
NATS_EXTERN const char * natsSubscription_GetSubject(natsSubscription *sub)
Gets the subject name.
natsSubscription_SetOnCompleteCB
NATS_EXTERN natsStatus natsSubscription_SetOnCompleteCB(natsSubscription *sub, natsOnCompleteCB cb, void *closure)
Sets a completion callback.
natsSubscription_Unsubscribe
NATS_EXTERN natsStatus natsSubscription_Unsubscribe(natsSubscription *sub)
Unsubscribes.
natsSubscription_ClearMaxPending
NATS_EXTERN natsStatus natsSubscription_ClearMaxPending(natsSubscription *sub)
Clears the statistics regarding the maximum pending values.
stanSubOptions
struct __stanSubOptions stanSubOptions
Way to configure a stanSubscription.
Definition nats.h:1416
kvStore
struct __kvStore kvStore
Definition nats.h:1252
jsStorageCompression
jsStorageCompression
Definition nats.h:304
jsDeliverPolicy
jsDeliverPolicy
Definition nats.h:313
stanConnOptions
struct __stanConnOptions stanConnOptions
Way to configure a stanConnection.
Definition nats.h:1410
jsStorageType
jsStorageType
Definition nats.h:294
natsInbox
char natsInbox
Unique subject often used for point-to-point communication.
Definition nats.h:187
stanMsg
struct __stanMsg stanMsg
The Streaming message.
Definition nats.h:1404
jsRetentionPolicy
jsRetentionPolicy
Definition nats.h:273
kvWatcher
struct __kvWatcher kvWatcher
Definition nats.h:1267
natsStatistics
struct __natsStatistics natsStatistics
Statistics of a natsConnection.
Definition nats.h:159
jsDiscardPolicy
jsDiscardPolicy
Definition nats.h:284
jsReplayPolicy
jsReplayPolicy
Definition nats.h:339
natsSubscription
struct __natsSubscription natsSubscription
Interest on a given subject.
Definition nats.h:165
kvOperation
kvOperation
Definition nats.h:1273
jsAckPolicy
jsAckPolicy
Definition nats.h:327
stanConnection
struct __stanConnection stanConnection
A connection to a NATS Streaming Server.
Definition nats.h:1392
jsCtx
struct __jsCtx jsCtx
Definition nats.h:240
natsOptions
struct __natsOptions natsOptions
Way to configure a natsConnection.
Definition nats.h:178
kvStatus
struct __kvStatus kvStatus
Definition nats.h:1262
kvEntry
struct __kvEntry kvEntry
Definition nats.h:1257
natsMsg
struct __natsMsg natsMsg
A structure holding a subject, optional reply and payload.
Definition nats.h:172
stanSubscription
struct __stanSubscription stanSubscription
Interest on a given channel.
Definition nats.h:1398
natsConnection
struct __natsConnection natsConnection
A connection to a NATS Server.
Definition nats.h:152
js_StorageCompressionNone
@ js_StorageCompressionNone
Specifies no compression. It's the default.
Definition nats.h:305
js_StorageCompressionS2
@ js_StorageCompressionS2
Specifies S2.
Definition nats.h:306
js_DeliverByStartSequence
@ js_DeliverByStartSequence
Starts from a given sequence.
Definition nats.h:317
js_DeliverByStartTime
@ js_DeliverByStartTime
Starts from a given UTC time (number of nanoseconds since epoch)
Definition nats.h:318
js_DeliverNew
@ js_DeliverNew
Starts with messages sent after the consumer is created.
Definition nats.h:316
js_DeliverLastPerSubject
@ js_DeliverLastPerSubject
Starts with the last message for all subjects received.
Definition nats.h:319
js_DeliverLast
@ js_DeliverLast
Starts with the last sequence received.
Definition nats.h:315
js_DeliverAll
@ js_DeliverAll
Starts from the very beginning of a stream. This is the default.
Definition nats.h:314
js_FileStorage
@ js_FileStorage
Specifies on disk storage. It's the default.
Definition nats.h:295
js_MemoryStorage
@ js_MemoryStorage
Specifies in memory only.
Definition nats.h:296
js_LimitsPolicy
@ js_LimitsPolicy
Specifies that messages are retained until any given limit is reached, which could be one of MaxMsgs,...
Definition nats.h:274
js_InterestPolicy
@ js_InterestPolicy
Specifies that when all known observables have acknowledged a message it can be removed.
Definition nats.h:275
js_WorkQueuePolicy
@ js_WorkQueuePolicy
Specifies that when the first worker or subscriber acknowledges the message it can be removed.
Definition nats.h:276
js_DiscardNew
@ js_DiscardNew
Will fail to store new messages.
Definition nats.h:286
js_DiscardOld
@ js_DiscardOld
Will remove older messages to return to the limits. This is the default.
Definition nats.h:285
js_ReplayInstant
@ js_ReplayInstant
Replays messages as fast as possible.
Definition nats.h:340
js_ReplayOriginal
@ js_ReplayOriginal
Maintains the same timing as the messages were received.
Definition nats.h:341
kvOp_Unknown
@ kvOp_Unknown
Definition nats.h:1274
kvOp_Delete
@ kvOp_Delete
Definition nats.h:1276
kvOp_Put
@ kvOp_Put
Definition nats.h:1275
kvOp_Purge
@ kvOp_Purge
Definition nats.h:1277
js_AckExplicit
@ js_AckExplicit
Requires ack or nack for all messages.
Definition nats.h:328
js_AckAll
@ js_AckAll
When acking a sequence number, this implicitly acks all sequences below this one as well.
Definition nats.h:330
js_AckNone
@ js_AckNone
Requires no acks for delivered messages.
Definition nats.h:329
NATS_EXTERN
#define NATS_EXTERN
Needed for shared library.
Definition nats.h:49
natsSock
int natsSock
Definition nats.h:50
status.h
jsErrCode
jsErrCode
Definition status.h:135
natsStatus
natsStatus
Status returned by most of the APIs.
Definition status.h:50
natsConnStatus
natsConnStatus
The connection state.
Definition status.h:24
jsAPIStats
Definition nats.h:1041
jsAPIStats::Total
uint64_t Total
Definition nats.h:1042
jsAPIStats::Errors
uint64_t Errors
Definition nats.h:1043
jsAccountInfo
Definition nats.h:1078
jsAccountInfo::Consumers
int64_t Consumers
Definition nats.h:1082
jsAccountInfo::Streams
int64_t Streams
Definition nats.h:1081
jsAccountInfo::TiersLen
int TiersLen
Definition nats.h:1087
jsAccountInfo::Memory
uint64_t Memory
Definition nats.h:1079
jsAccountInfo::API
jsAPIStats API
Definition nats.h:1084
jsAccountInfo::Limits
jsAccountLimits Limits
Definition nats.h:1085
jsAccountInfo::Tiers
jsTier ** Tiers
Definition nats.h:1086
jsAccountInfo::Domain
char * Domain
Definition nats.h:1083
jsAccountInfo::Store
uint64_t Store
Definition nats.h:1080
jsAccountLimits
Definition nats.h:1051
jsAccountLimits::MemoryMaxStreamBytes
int64_t MemoryMaxStreamBytes
Definition nats.h:1057
jsAccountLimits::MaxStreams
int64_t MaxStreams
Definition nats.h:1054
jsAccountLimits::MaxAckPending
int64_t MaxAckPending
Definition nats.h:1056
jsAccountLimits::MaxConsumers
int64_t MaxConsumers
Definition nats.h:1055
jsAccountLimits::MaxStore
int64_t MaxStore
Definition nats.h:1053
jsAccountLimits::MaxMemory
int64_t MaxMemory
Definition nats.h:1052
jsAccountLimits::MaxBytesRequired
bool MaxBytesRequired
Definition nats.h:1059
jsAccountLimits::StoreMaxStreamBytes
int64_t StoreMaxStreamBytes
Definition nats.h:1058
jsClusterInfo
Definition nats.h:688
jsClusterInfo::ReplicasLen
int ReplicasLen
Definition nats.h:692
jsClusterInfo::Name
char * Name
Definition nats.h:689
jsClusterInfo::Replicas
jsPeerInfo ** Replicas
Definition nats.h:691
jsClusterInfo::Leader
char * Leader
Definition nats.h:690
jsConsumerConfig
Definition nats.h:814
jsConsumerConfig::MemoryStorage
bool MemoryStorage
Definition nats.h:851
jsConsumerConfig::Name
const char * Name
Definition nats.h:815
jsConsumerConfig::FilterSubjectsLen
int FilterSubjectsLen
Definition nats.h:857
jsConsumerConfig::OptStartSeq
uint64_t OptStartSeq
Definition nats.h:819
jsConsumerConfig::HeadersOnly
bool HeadersOnly
Definition nats.h:834
jsConsumerConfig::RateLimit
uint64_t RateLimit
Definition nats.h:828
jsConsumerConfig::DeliverPolicy
jsDeliverPolicy DeliverPolicy
Definition nats.h:818
jsConsumerConfig::Description
const char * Description
Definition nats.h:817
jsConsumerConfig::Durable
const char * Durable
Definition nats.h:816
jsConsumerConfig::SampleFrequency
const char * SampleFrequency
Definition nats.h:829
jsConsumerConfig::FlowControl
bool FlowControl
Definition nats.h:832
jsConsumerConfig::MaxRequestBatch
int64_t MaxRequestBatch
Maximum Pull Consumer request batch size.
Definition nats.h:837
jsConsumerConfig::AckWait
int64_t AckWait
Definition nats.h:822
jsConsumerConfig::MaxRequestMaxBytes
int64_t MaxRequestMaxBytes
Maximum Pull Consumer request maximum bytes.
Definition nats.h:839
jsConsumerConfig::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:820
jsConsumerConfig::MaxWaiting
int64_t MaxWaiting
Definition nats.h:830
jsConsumerConfig::AckPolicy
jsAckPolicy AckPolicy
Definition nats.h:821
jsConsumerConfig::Metadata
natsMetadata Metadata
Definition nats.h:860
jsConsumerConfig::DeliverSubject
const char * DeliverSubject
Definition nats.h:842
jsConsumerConfig::BackOff
int64_t * BackOff
Redelivery durations expressed in nanoseconds.
Definition nats.h:824
jsConsumerConfig::MaxRequestExpires
int64_t MaxRequestExpires
Maximum Pull Consumer request expiration, expressed in number of nanoseconds.
Definition nats.h:838
jsConsumerConfig::Heartbeat
int64_t Heartbeat
Heartbeat interval expressed in number of nanoseconds.
Definition nats.h:833
jsConsumerConfig::Replicas
int64_t Replicas
Definition nats.h:849
jsConsumerConfig::BackOffLen
int BackOffLen
Definition nats.h:825
jsConsumerConfig::MaxDeliver
int64_t MaxDeliver
Definition nats.h:823
jsConsumerConfig::FilterSubjects
const char ** FilterSubjects
Definition nats.h:856
jsConsumerConfig::ReplayPolicy
jsReplayPolicy ReplayPolicy
Definition nats.h:827
jsConsumerConfig::DeliverGroup
const char * DeliverGroup
Definition nats.h:843
jsConsumerConfig::MaxAckPending
int64_t MaxAckPending
Definition nats.h:831
jsConsumerConfig::FilterSubject
const char * FilterSubject
Definition nats.h:826
jsConsumerConfig::InactiveThreshold
int64_t InactiveThreshold
How long the server keeps an ephemeral after detecting loss of interest, expressed in number of nanos...
Definition nats.h:846
jsConsumerInfo
Definition nats.h:993
jsConsumerInfo::Delivered
jsSequenceInfo Delivered
Definition nats.h:998
jsConsumerInfo::Config
jsConsumerConfig * Config
Definition nats.h:997
jsConsumerInfo::PushBound
bool PushBound
Definition nats.h:1005
jsConsumerInfo::NumWaiting
int64_t NumWaiting
Definition nats.h:1002
jsConsumerInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:996
jsConsumerInfo::Cluster
jsClusterInfo * Cluster
Definition nats.h:1004
jsConsumerInfo::NumAckPending
int64_t NumAckPending
Definition nats.h:1000
jsConsumerInfo::Stream
char * Stream
Definition nats.h:994
jsConsumerInfo::NumRedelivered
int64_t NumRedelivered
Definition nats.h:1001
jsConsumerInfo::Name
char * Name
Definition nats.h:995
jsConsumerInfo::AckFloor
jsSequenceInfo AckFloor
Definition nats.h:999
jsConsumerInfo::NumPending
uint64_t NumPending
Definition nats.h:1003
jsConsumerInfoList
Definition nats.h:1017
jsConsumerInfoList::List
jsConsumerInfo ** List
Definition nats.h:1018
jsConsumerInfoList::Count
int Count
Definition nats.h:1019
jsConsumerNamesList
Definition nats.h:1031
jsConsumerNamesList::Count
int Count
Definition nats.h:1033
jsConsumerNamesList::List
char ** List
Definition nats.h:1032
jsConsumerSequenceMismatch
Definition nats.h:881
jsConsumerSequenceMismatch::Stream
uint64_t Stream
This is the stream sequence that the application should resume from.
Definition nats.h:882
jsConsumerSequenceMismatch::ConsumerServer
uint64_t ConsumerServer
This is the consumer sequence last sent by the server.
Definition nats.h:884
jsConsumerSequenceMismatch::ConsumerClient
uint64_t ConsumerClient
This is the consumer sequence that was last received by the library.
Definition nats.h:883
jsDirectGetMsgOptions
Definition nats.h:1151
jsDirectGetMsgOptions::NextBySubject
const char * NextBySubject
Get the next message (based on sequence) for that subject.
Definition nats.h:1153
jsDirectGetMsgOptions::Sequence
uint64_t Sequence
Get the message at this sequence.
Definition nats.h:1152
jsDirectGetMsgOptions::LastBySubject
const char * LastBySubject
Get the last message on that subject.
Definition nats.h:1154
jsExternalStream
Definition nats.h:375
jsExternalStream::DeliverPrefix
const char * DeliverPrefix
Definition nats.h:377
jsExternalStream::APIPrefix
const char * APIPrefix
Definition nats.h:376
jsFetchRequest
Definition nats.h:1164
jsFetchRequest::MaxBytes
int64_t MaxBytes
Maximum bytes for the request (request complete based on whichever Batch or MaxBytes comes first)
Definition nats.h:1167
jsFetchRequest::Batch
int Batch
Maximum number of messages to be received (see MaxBytes)
Definition nats.h:1166
jsFetchRequest::Expires
int64_t Expires
Expiration of the request, expressed in nanoseconds.
Definition nats.h:1165
jsFetchRequest::NoWait
bool NoWait
Will not wait if the request cannot be completed.
Definition nats.h:1168
jsFetchRequest::Heartbeat
int64_t Heartbeat
Have server sends heartbeats to help detect communication failures.
Definition nats.h:1169
jsLostStreamData
Definition nats.h:590
jsLostStreamData::Msgs
uint64_t * Msgs
Definition nats.h:591
jsLostStreamData::Bytes
uint64_t Bytes
Definition nats.h:593
jsLostStreamData::MsgsLen
int MsgsLen
Definition nats.h:592
jsMsgMetaData
Definition nats.h:1099
jsMsgMetaData::NumPending
uint64_t NumPending
Definition nats.h:1102
jsMsgMetaData::Sequence
jsSequencePair Sequence
Definition nats.h:1100
jsMsgMetaData::Stream
char * Stream
Definition nats.h:1104
jsMsgMetaData::Domain
char * Domain
Definition nats.h:1106
jsMsgMetaData::Consumer
char * Consumer
Definition nats.h:1105
jsMsgMetaData::NumDelivered
uint64_t NumDelivered
Definition nats.h:1101
jsMsgMetaData::Timestamp
int64_t Timestamp
Definition nats.h:1103
jsOptions::jsOptionsPublishAsync
Definition nats.h:1188
jsOptions::jsOptionsPublishAsync::ErrHandler
jsPubAckErrHandler ErrHandler
Callback invoked when error encountered publishing a given message.
Definition nats.h:1203
jsOptions::jsOptionsPublishAsync::AckHandler
jsPubAckHandler AckHandler
Callback invoked for each asynchronous published message.
Definition nats.h:1196
jsOptions::jsOptionsPublishAsync::AckHandlerClosure
void * AckHandlerClosure
Closure (or user data) passed to jsPubAckHandler callback.
Definition nats.h:1197
jsOptions::jsOptionsPublishAsync::ErrHandlerClosure
void * ErrHandlerClosure
Closure (or user data) passed to jsPubAckErrHandler callback.
Definition nats.h:1204
jsOptions::jsOptionsPublishAsync::StallWait
int64_t StallWait
Amount of time (in milliseconds) to wait in a PublishAsync call when there is MaxPending inflight mes...
Definition nats.h:1206
jsOptions::jsOptionsPublishAsync::MaxPending
int64_t MaxPending
Maximum outstanding asynchronous publishes that can be inflight at one time.
Definition nats.h:1189
jsOptions::jsOptionsStream::jsOptionsStreamInfo
Definition nats.h:1239
jsOptions::jsOptionsStream::jsOptionsStreamInfo::DeletedDetails
bool DeletedDetails
Get the list of deleted message sequences.
Definition nats.h:1240
jsOptions::jsOptionsStream::jsOptionsStreamInfo::SubjectsFilter
const char * SubjectsFilter
Get the list of subjects in this stream.
Definition nats.h:1241
jsOptions::jsOptionsStream::jsOptionsStreamPurge
Definition nats.h:1228
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Sequence
uint64_t Sequence
Purge up to but not including sequence.
Definition nats.h:1230
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Keep
uint64_t Keep
Number of messages to keep.
Definition nats.h:1231
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Subject
const char * Subject
This is the subject to match against messages for the purge command.
Definition nats.h:1229
jsOptions::jsOptionsStream
Definition nats.h:1217
jsOptions::jsOptionsStream::Info
struct jsOptions::jsOptionsStream::jsOptionsStreamInfo Info
Optional stream information retrieval options.
jsOptions::jsOptionsStream::Purge
struct jsOptions::jsOptionsStream::jsOptionsStreamPurge Purge
Optional stream purge options.
jsOptions
Definition nats.h:1179
jsOptions::PublishAsync
struct jsOptions::jsOptionsPublishAsync PublishAsync
jsOptions::Wait
int64_t Wait
Amount of time (in milliseconds) to wait for various JetStream API requests, default is 5000 ms (5 se...
Definition nats.h:1182
jsOptions::Prefix
const char * Prefix
JetStream prefix, default is "$JS.API".
Definition nats.h:1180
jsOptions::Domain
const char * Domain
Domain changes the domain part of JetSteam API prefix.
Definition nats.h:1181
jsOptions::Stream
struct jsOptions::jsOptionsStream Stream
Optional stream options.
jsPeerInfo
Definition nats.h:674
jsPeerInfo::Offline
bool Offline
Definition nats.h:677
jsPeerInfo::Lag
uint64_t Lag
Definition nats.h:679
jsPeerInfo::Active
int64_t Active
Definition nats.h:678
jsPeerInfo::Name
char * Name
Definition nats.h:675
jsPeerInfo::Current
bool Current
Definition nats.h:676
jsPlacement
Definition nats.h:358
jsPlacement::TagsLen
int TagsLen
Definition nats.h:361
jsPlacement::Cluster
const char * Cluster
Definition nats.h:359
jsPlacement::Tags
const char ** Tags
Definition nats.h:360
jsPubAckErr
Definition nats.h:1127
jsPubAckErr::Msg
natsMsg * Msg
Definition nats.h:1128
jsPubAckErr::Err
natsStatus Err
Definition nats.h:1129
jsPubAckErr::ErrCode
jsErrCode ErrCode
Definition nats.h:1130
jsPubAckErr::ErrText
const char * ErrText
Definition nats.h:1131
jsPubAck
Definition nats.h:1114
jsPubAck::Sequence
uint64_t Sequence
Definition nats.h:1116
jsPubAck::Duplicate
bool Duplicate
Definition nats.h:1118
jsPubAck::Domain
char * Domain
Definition nats.h:1117
jsPubAck::Stream
char * Stream
Definition nats.h:1115
jsPubOptions
Definition nats.h:258
jsPubOptions::ExpectLastMsgId
const char * ExpectLastMsgId
Expected last message ID in the stream.
Definition nats.h:262
jsPubOptions::MaxWait
int64_t MaxWait
Amount of time (in milliseconds) to wait for a publish response, default will the context's Wait valu...
Definition nats.h:259
jsPubOptions::ExpectLastSeq
uint64_t ExpectLastSeq
Expected last message sequence in the stream.
Definition nats.h:263
jsPubOptions::ExpectNoMessage
bool ExpectNoMessage
Expected no message (that is, sequence == 0) for the subject in the stream.
Definition nats.h:265
jsPubOptions::ExpectStream
const char * ExpectStream
Expected stream to respond from the publish call.
Definition nats.h:261
jsPubOptions::MsgId
const char * MsgId
Message ID used for de-duplication.
Definition nats.h:260
jsPubOptions::ExpectLastSubjectSeq
uint64_t ExpectLastSubjectSeq
Expected last message sequence for the subject in the stream.
Definition nats.h:264
jsRePublish
Definition nats.h:411
jsRePublish::HeadersOnly
bool HeadersOnly
Definition nats.h:414
jsRePublish::Source
const char * Source
Definition nats.h:412
jsRePublish::Destination
const char * Destination
Definition nats.h:413
jsSequenceInfo
Definition nats.h:979
jsSequenceInfo::Last
int64_t Last
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:982
jsSequenceInfo::Stream
uint64_t Stream
Definition nats.h:981
jsSequenceInfo::Consumer
uint64_t Consumer
Definition nats.h:980
jsSequencePair
Definition nats.h:969
jsSequencePair::Consumer
uint64_t Consumer
Definition nats.h:970
jsSequencePair::Stream
uint64_t Stream
Definition nats.h:971
jsStreamAlternate
Definition nats.h:715
jsStreamAlternate::Name
const char * Name
Definition nats.h:716
jsStreamAlternate::Cluster
const char * Cluster
Definition nats.h:718
jsStreamAlternate::Domain
const char * Domain
Definition nats.h:717
jsStreamConfig
Definition nats.h:517
jsStreamConfig::Discard
jsDiscardPolicy Discard
Definition nats.h:529
jsStreamConfig::Subjects
const char ** Subjects
Definition nats.h:520
jsStreamConfig::SubjectTransform
jsSubjectTransformConfig SubjectTransform
Definition nats.h:582
jsStreamConfig::AllowDirect
bool AllowDirect
Definition nats.h:552
jsStreamConfig::SourcesLen
int SourcesLen
Definition nats.h:538
jsStreamConfig::DiscardNewPerSubject
bool DiscardNewPerSubject
Definition nats.h:557
jsStreamConfig::Compression
jsStorageCompression Compression
Definition nats.h:580
jsStreamConfig::Description
const char * Description
Definition nats.h:519
jsStreamConfig::Template
const char * Template
Definition nats.h:533
jsStreamConfig::DenyPurge
bool DenyPurge
Restrict the ability to purge messages.
Definition nats.h:541
jsStreamConfig::Storage
jsStorageType Storage
Definition nats.h:530
jsStreamConfig::ConsumerLimits
jsStreamConsumerLimits ConsumerLimits
Definition nats.h:583
jsStreamConfig::Retention
jsRetentionPolicy Retention
Definition nats.h:522
jsStreamConfig::MaxMsgs
int64_t MaxMsgs
Definition nats.h:524
jsStreamConfig::MaxConsumers
int64_t MaxConsumers
Definition nats.h:523
jsStreamConfig::Metadata
natsMetadata Metadata
Configuration options introduced in 2.10.
Definition nats.h:579
jsStreamConfig::FirstSeq
uint64_t FirstSeq
Definition nats.h:581
jsStreamConfig::Name
const char * Name
Definition nats.h:518
jsStreamConfig::NoAck
bool NoAck
Definition nats.h:532
jsStreamConfig::Sources
jsStreamSource ** Sources
Definition nats.h:537
jsStreamConfig::MaxMsgSize
int32_t MaxMsgSize
Definition nats.h:528
jsStreamConfig::RePublish
jsRePublish * RePublish
Definition nats.h:549
jsStreamConfig::MirrorDirect
bool MirrorDirect
Definition nats.h:554
jsStreamConfig::Duplicates
int64_t Duplicates
Definition nats.h:534
jsStreamConfig::MaxMsgsPerSubject
int64_t MaxMsgsPerSubject
Definition nats.h:527
jsStreamConfig::MaxAge
int64_t MaxAge
Definition nats.h:526
jsStreamConfig::SubjectsLen
int SubjectsLen
Definition nats.h:521
jsStreamConfig::AllowRollup
bool AllowRollup
Definition nats.h:546
jsStreamConfig::Mirror
jsStreamSource * Mirror
Definition nats.h:536
jsStreamConfig::Placement
jsPlacement * Placement
Definition nats.h:535
jsStreamConfig::MaxBytes
int64_t MaxBytes
Definition nats.h:525
jsStreamConfig::Replicas
int64_t Replicas
Definition nats.h:531
jsStreamConfig::Sealed
bool Sealed
Seal a stream so no messages can get our or in.
Definition nats.h:539
jsStreamConfig::DenyDelete
bool DenyDelete
Restrict the ability to delete messages.
Definition nats.h:540
jsStreamConsumerLimits
Definition nats.h:433
jsStreamConsumerLimits::MaxAckPending
int MaxAckPending
Definition nats.h:435
jsStreamConsumerLimits::InactiveThreshold
int64_t InactiveThreshold
Definition nats.h:434
jsStreamInfo
Definition nats.h:729
jsStreamInfo::Sources
jsStreamSourceInfo ** Sources
Definition nats.h:735
jsStreamInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:731
jsStreamInfo::Alternates
jsStreamAlternate ** Alternates
Definition nats.h:737
jsStreamInfo::State
jsStreamState State
Definition nats.h:732
jsStreamInfo::Cluster
jsClusterInfo * Cluster
Definition nats.h:733
jsStreamInfo::Mirror
jsStreamSourceInfo * Mirror
Definition nats.h:734
jsStreamInfo::AlternatesLen
int AlternatesLen
Definition nats.h:738
jsStreamInfo::Config
jsStreamConfig * Config
Definition nats.h:730
jsStreamInfo::SourcesLen
int SourcesLen
Definition nats.h:736
jsStreamInfoList
Definition nats.h:750
jsStreamInfoList::List
jsStreamInfo ** List
Definition nats.h:751
jsStreamInfoList::Count
int Count
Definition nats.h:752
jsStreamNamesList
Definition nats.h:764
jsStreamNamesList::List
char ** List
Definition nats.h:765
jsStreamNamesList::Count
int Count
Definition nats.h:766
jsStreamSource
Definition nats.h:394
jsStreamSource::External
jsExternalStream * External
Definition nats.h:399
jsStreamSource::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:397
jsStreamSource::Name
const char * Name
Definition nats.h:395
jsStreamSource::Domain
const char * Domain
Definition nats.h:403
jsStreamSource::OptStartSeq
uint64_t OptStartSeq
Definition nats.h:396
jsStreamSource::FilterSubject
const char * FilterSubject
Definition nats.h:398
jsStreamSourceInfo
Definition nats.h:700
jsStreamSourceInfo::FilterSubject
const char * FilterSubject
Definition nats.h:705
jsStreamSourceInfo::Active
int64_t Active
Definition nats.h:704
jsStreamSourceInfo::SubjectTransformsLen
int SubjectTransformsLen
Definition nats.h:707
jsStreamSourceInfo::Name
char * Name
Definition nats.h:701
jsStreamSourceInfo::External
jsExternalStream * External
Definition nats.h:702
jsStreamSourceInfo::Lag
uint64_t Lag
Definition nats.h:703
jsStreamSourceInfo::SubjectTransforms
jsSubjectTransformConfig * SubjectTransforms
Definition nats.h:706
jsStreamState
Definition nats.h:652
jsStreamState::Lost
jsLostStreamData * Lost
Definition nats.h:664
jsStreamState::LastSeq
uint64_t LastSeq
Definition nats.h:657
jsStreamState::Consumers
int64_t Consumers
Definition nats.h:665
jsStreamState::DeletedLen
int DeletedLen
Definition nats.h:663
jsStreamState::Msgs
uint64_t Msgs
Definition nats.h:653
jsStreamState::Subjects
jsStreamStateSubjects * Subjects
Definition nats.h:660
jsStreamState::FirstSeq
uint64_t FirstSeq
Definition nats.h:655
jsStreamState::LastTime
int64_t LastTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:658
jsStreamState::NumSubjects
int64_t NumSubjects
Definition nats.h:659
jsStreamState::Deleted
uint64_t * Deleted
Definition nats.h:662
jsStreamState::NumDeleted
uint64_t NumDeleted
Definition nats.h:661
jsStreamState::Bytes
uint64_t Bytes
Definition nats.h:654
jsStreamState::FirstTime
int64_t FirstTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:656
jsStreamStateSubject
Definition nats.h:603
jsStreamStateSubject::Msgs
uint64_t Msgs
Definition nats.h:605
jsStreamStateSubject::Subject
const char * Subject
Definition nats.h:604
jsStreamStateSubjects
Definition nats.h:639
jsStreamStateSubjects::Count
int Count
Definition nats.h:641
jsStreamStateSubjects::List
jsStreamStateSubject * List
Definition nats.h:640
jsSubOptions
Definition nats.h:904
jsSubOptions::ManualAck
bool ManualAck
If true, the user will have to acknowledge the messages.
Definition nats.h:949
jsSubOptions::Consumer
const char * Consumer
If specified, the subscription will be bound to an existing consumer from the Stream without attempti...
Definition nats.h:921
jsSubOptions::Stream
const char * Stream
If specified, the consumer will be bound to this stream name.
Definition nats.h:911
jsSubOptions::Ordered
bool Ordered
If true, this will be an ordered consumer.
Definition nats.h:961
jsSubOptions::Queue
const char * Queue
Queue name for queue subscriptions.
Definition nats.h:936
jsSubOptions::Config
jsConsumerConfig Config
Consumer configuration.
Definition nats.h:954
jsSubjectTransformConfig
Definition nats.h:423
jsSubjectTransformConfig::Destination
const char * Destination
Definition nats.h:425
jsSubjectTransformConfig::Source
const char * Source
Definition nats.h:424
jsTier
Definition nats.h:1064
jsTier::Name
const char * Name
Definition nats.h:1065
jsTier::Streams
int64_t Streams
Definition nats.h:1068
jsTier::Store
uint64_t Store
Definition nats.h:1067
jsTier::Consumers
int64_t Consumers
Definition nats.h:1069
jsTier::Memory
uint64_t Memory
Definition nats.h:1066
jsTier::Limits
jsAccountLimits Limits
Definition nats.h:1070
kvConfig
Definition nats.h:1287
kvConfig::History
uint8_t History
Definition nats.h:1291
kvConfig::Bucket
const char * Bucket
Definition nats.h:1288
kvConfig::MaxBytes
int64_t MaxBytes
Definition nats.h:1293
kvConfig::MaxValueSize
int32_t MaxValueSize
Definition nats.h:1290
kvConfig::Replicas
int Replicas
Definition nats.h:1295
kvConfig::Description
const char * Description
Definition nats.h:1289
kvConfig::Mirror
jsStreamSource * Mirror
Definition nats.h:1297
kvConfig::TTL
int64_t TTL
Definition nats.h:1292
kvConfig::StorageType
jsStorageType StorageType
Definition nats.h:1294
kvConfig::RePublish
jsRePublish * RePublish
Definition nats.h:1296
kvConfig::SourcesLen
int SourcesLen
Definition nats.h:1299
kvConfig::Sources
jsStreamSource ** Sources
Definition nats.h:1298
kvEntryList
A list of KeyValue store entries.
Definition nats.h:1357
kvEntryList::Entries
kvEntry ** Entries
Definition nats.h:1358
kvEntryList::Count
int Count
Definition nats.h:1359
kvKeysList
A list of KeyValue store keys.
Definition nats.h:1381
kvKeysList::Count
int Count
Definition nats.h:1383
kvKeysList::Keys
char ** Keys
Definition nats.h:1382
kvPurgeOptions
Definition nats.h:1323
kvPurgeOptions::Timeout
int64_t Timeout
Definition nats.h:1325
kvPurgeOptions::DeleteMarkersOlderThan
int64_t DeleteMarkersOlderThan
Definition nats.h:1335
kvWatchOptions
Definition nats.h:1309
kvWatchOptions::IgnoreDeletes
bool IgnoreDeletes
Definition nats.h:1310
kvWatchOptions::IncludeHistory
bool IncludeHistory
Definition nats.h:1311
kvWatchOptions::Timeout
int64_t Timeout
How long to wait (in milliseconds) for some operations to complete.
Definition nats.h:1313
kvWatchOptions::MetaOnly
bool MetaOnly
Definition nats.h:1312
micro_endpoint_config_s
Definition nats.h:7437
micro_endpoint_config_s::Name
const char * Name
The name of the endpoint.
Definition nats.h:7443
micro_endpoint_config_s::Handler
microRequestHandler Handler
The request handler for the endpoint.
Definition nats.h:7465
micro_endpoint_config_s::Subject
const char * Subject
The NATS subject the endpoint will listen on.
Definition nats.h:7454
micro_endpoint_config_s::Metadata
natsMetadata Metadata
Definition nats.h:7460
micro_endpoint_config_s::State
void * State
A user-provided pointer to store with the endpoint (state/closure).
Definition nats.h:7471
micro_endpoint_info_s
Definition nats.h:7478
micro_endpoint_info_s::Subject
const char * Subject
The semantic version of the service.
Definition nats.h:7487
micro_endpoint_info_s::Name
const char * Name
The name of the service.
Definition nats.h:7482
micro_endpoint_info_s::Metadata
natsMetadata Metadata
Definition nats.h:7493
micro_endpoint_stats_s
Definition nats.h:7500
micro_endpoint_stats_s::Subject
const char * Subject
Definition nats.h:7502
micro_endpoint_stats_s::NumRequests
int64_t NumRequests
The number of requests received by the endpoint.
Definition nats.h:7507
micro_endpoint_stats_s::LastErrorString
char LastErrorString[2048]
a copy of the last error message.
Definition nats.h:7533
micro_endpoint_stats_s::ProcessingTimeSeconds
int64_t ProcessingTimeSeconds
total request processing time (the seconds part).
Definition nats.h:7518
micro_endpoint_stats_s::ProcessingTimeNanoseconds
int64_t ProcessingTimeNanoseconds
total request processing time (the nanoseconds part).
Definition nats.h:7523
micro_endpoint_stats_s::NumErrors
int64_t NumErrors
The number of errors, service-level and internal, associated with the endpoint.
Definition nats.h:7513
micro_endpoint_stats_s::AverageProcessingTimeNanoseconds
int64_t AverageProcessingTimeNanoseconds
average request processing time, in ns.
Definition nats.h:7528
micro_endpoint_stats_s::Name
const char * Name
Definition nats.h:7501
micro_service_config_s
The Microservice top-level configuration object.
Definition nats.h:7543
micro_service_config_s::Description
const char * Description
The description of the service.
Definition nats.h:7559
micro_service_config_s::State
void * State
A user-provided pointer to state data.
Definition nats.h:7610
micro_service_config_s::Version
const char * Version
The (semantic) version of the service.
Definition nats.h:7554
micro_service_config_s::ErrHandler
microErrorHandler ErrHandler
An error notification handler.
Definition nats.h:7591
micro_service_config_s::Metadata
natsMetadata Metadata
Metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:7564
micro_service_config_s::StatsHandler
microRequestHandler StatsHandler
A custom stats handler.
Definition nats.h:7582
micro_service_config_s::DoneHandler
microDoneHandler DoneHandler
A callback handler for handling the final cleanup Done event, right before the service is destroyed.
Definition nats.h:7601
micro_service_config_s::Name
const char * Name
The name of the service.
Definition nats.h:7549
micro_service_config_s::Endpoint
microEndpointConfig * Endpoint
The "main" (aka default) endpoint configuration.
Definition nats.h:7573
micro_service_info_s
Definition nats.h:7619
micro_service_info_s::Metadata
natsMetadata Metadata
Metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:7648
micro_service_info_s::Name
const char * Name
The name of the service.
Definition nats.h:7628
micro_service_info_s::Version
const char * Version
The semantic version of the service.
Definition nats.h:7633
micro_service_info_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.info_response".
Definition nats.h:7623
micro_service_info_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:7643
micro_service_info_s::Endpoints
microEndpointInfo * Endpoints
Endpoints.
Definition nats.h:7653
micro_service_info_s::Description
const char * Description
The description of the service.
Definition nats.h:7638
micro_service_info_s::EndpointsLen
int EndpointsLen
The number of endpoints in the Endpoints array.
Definition nats.h:7658
micro_service_stats_s
Definition nats.h:7665
micro_service_stats_s::Started
int64_t Started
The timestamp of when the service was started.
Definition nats.h:7689
micro_service_stats_s::EndpointsLen
int EndpointsLen
The number of endpoints in the endpoints array.
Definition nats.h:7699
micro_service_stats_s::Endpoints
microEndpointStats * Endpoints
The stats for each endpoint of the service.
Definition nats.h:7694
micro_service_stats_s::Version
const char * Version
The semantic version of the service.
Definition nats.h:7679
micro_service_stats_s::Name
const char * Name
The name of the service.
Definition nats.h:7674
micro_service_stats_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.stats_response".
Definition nats.h:7669
micro_service_stats_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:7684
natsMetadata
A type to represent user-provided metadata, a list of k=v pairs.
Definition nats.h:225
natsMetadata::Count
int Count
Definition nats.h:229
natsMetadata::List
const char ** List
Definition nats.h:227
natsMsgList
A list of NATS messages.
Definition nats.h:213
natsMsgList::Count
int Count
Definition nats.h:215
natsMsgList::Msgs
natsMsg ** Msgs
Definition nats.h:214