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

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

Loading...
Searching...
No Matches
nats.h
Go to the documentation of this file.
1// Copyright 2015-2024 The NATS Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef NATS_H_
15#define NATS_H_
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdlib.h>
22#include <stdint.h>
23#include <stdbool.h>
24#include <inttypes.h>
25#include <stdio.h>
26
27#include "status.h"
28#include "version.h"
29
30#if defined(NATS_HAS_TLS)
31#include <openssl/ssl.h>
32#include <openssl/x509v3.h>
33#else
34#define X509_STORE_CTX void
35typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX* x509_ctx);
36#endif
37
45#if defined(_WIN32)
46 #include <winsock2.h>
47 #if defined(nats_EXPORTS)
48 #define NATS_EXTERN __declspec(dllexport)
49 #elif defined(nats_IMPORTS)
50 #define NATS_EXTERN __declspec(dllimport)
51 #else
52 #define NATS_EXTERN
53 #endif
54
55 typedef SOCKET natsSock;
56#else
57 #define NATS_EXTERN
58 typedef int natsSock;
59#endif
60
94#define NATS_DEFAULT_URL "nats://localhost:4222"
95
105 #define JSMsgSize "Nats-Msg-Size"
106
119 #define JSMsgRollup "Nats-Rollup"
120
128 #define JSMsgRollupSubject "sub"
129
137 #define JSMsgRollupAll "all"
138
139 // Headers for republished messages and direct get.
140 #define JSStream "Nats-Stream"
141 #define JSSequence "Nats-Sequence"
142 #define JSLastSequence "Nats-Last-Sequence"
143 #define JSTimeStamp "Nats-Time-Stamp"
144 #define JSSubject "Nats-Subject"
145
146//
147// Types.
148//
160 typedef struct __natsConnection natsConnection;
161
167 typedef struct __natsStatistics natsStatistics;
168
173 typedef struct __natsSubscription natsSubscription;
174
180 typedef struct __natsMsg natsMsg;
181
186 typedef struct __natsOptions natsOptions;
187
195 typedef char natsInbox;
196
197
203 typedef struct __natsClientConfig
204{
205 int64_t DefaultWriteDeadline;
206
207 int64_t LockSpinCount;
208
209 // Subscription message delivery thread control
210 bool DefaultToThreadPool;
211 int ThreadPoolMax;
212
213 // Reply message delivery thread control
214 bool DefaultRepliesToThreadPool;
215 bool UseSeparatePoolForReplies;
216 int ReplyThreadPoolMax;
217} natsClientConfig;
218
242 typedef struct natsMsgList
243{
244 natsMsg **Msgs;
245 int Count;
246
247} natsMsgList;
248
254 typedef struct natsMetadata
255{
256 // User-provided metadata for the stream, encoded as an array of {"key", "value",...}
257 const char **List;
258 // Number of key/value pairs in Metadata, 1/2 of the length of the array.
259 int Count;
260} natsMetadata;
261
270 typedef struct __jsCtx jsCtx;
271
287 typedef struct jsPubOptions
288{
289 int64_t MaxWait;
290 const char *MsgId;
291 const char *ExpectStream;
292 const char *ExpectLastMsgId;
293 uint64_t ExpectLastSeq;
294 uint64_t ExpectLastSubjectSeq;
295 bool ExpectNoMessage;
296
297} jsPubOptions;
298
302 typedef enum
303{
304 js_LimitsPolicy = 0,
305 js_InterestPolicy,
306 js_WorkQueuePolicy,
307
308} jsRetentionPolicy;
309
313 typedef enum
314{
315 js_DiscardOld = 0,
316 js_DiscardNew,
317
318} jsDiscardPolicy;
319
323 typedef enum
324{
325 js_FileStorage = 0,
326 js_MemoryStorage,
327
328} jsStorageType;
329
333 typedef enum
334{
335 js_StorageCompressionNone = 0,
336 js_StorageCompressionS2,
337} jsStorageCompression;
338
342 typedef enum
343{
344 js_DeliverAll = 0,
345 js_DeliverLast,
346 js_DeliverNew,
347 js_DeliverByStartSequence,
348 js_DeliverByStartTime,
349 js_DeliverLastPerSubject,
350
351} jsDeliverPolicy;
352
356 typedef enum
357{
358 js_AckExplicit = 0,
359 js_AckNone,
360 js_AckAll,
361
362
363} jsAckPolicy;
364
368 typedef enum
369{
370 js_ReplayInstant = 0,
371 js_ReplayOriginal,
372
373} jsReplayPolicy;
374
375
387 typedef struct jsPlacement
388{
389 const char *Cluster;
390 const char **Tags;
391 int TagsLen;
392
393} jsPlacement;
394
404 typedef struct jsExternalStream
405{
406 const char *APIPrefix;
407 const char *DeliverPrefix;
408
409} jsExternalStream;
410
423 typedef struct jsStreamSource
424{
425 const char *Name;
426 uint64_t OptStartSeq;
427 int64_t OptStartTime;
428 const char *FilterSubject;
429 jsExternalStream *External;
430 // Domain and External are mutually exclusive.
431 // If Domain is set, an External value will be created with
432 // the APIPrefix constructed based on the Domain value.
433 const char *Domain;
434
435} jsStreamSource;
436
440 typedef struct jsRePublish
441{
442 const char *Source;
443 const char *Destination;
444 bool HeadersOnly;
445
446} jsRePublish;
447
452 typedef struct jsSubjectTransformConfig
453{
454 const char *Source;
455 const char *Destination;
456} jsSubjectTransformConfig;
457
462 typedef struct jsStreamConsumerLimits
463{
464 int64_t InactiveThreshold;
465 int MaxAckPending;
466} jsStreamConsumerLimits;
467
547 typedef struct jsStreamConfig {
548 const char *Name;
549 const char *Description;
550 const char **Subjects;
551 int SubjectsLen;
552 jsRetentionPolicy Retention;
553 int64_t MaxConsumers;
554 int64_t MaxMsgs;
555 int64_t MaxBytes;
556 int64_t MaxAge;
557 int64_t MaxMsgsPerSubject;
558 int32_t MaxMsgSize;
559 jsDiscardPolicy Discard;
560 jsStorageType Storage;
561 int64_t Replicas;
562 bool NoAck;
563 const char *Template;
564 int64_t Duplicates;
565 jsPlacement *Placement;
566 jsStreamSource *Mirror;
567 jsStreamSource **Sources;
568 int SourcesLen;
569 bool Sealed;
570 bool DenyDelete;
571 bool DenyPurge;
572
575 bool AllowRollup;
576
579 jsRePublish *RePublish;
580
583 bool AllowDirect;
584
587 bool MirrorDirect;
588
591 bool DiscardNewPerSubject;
592
596 natsMetadata Metadata;
597
600 jsStorageCompression Compression;
601
603 uint64_t FirstSeq;
604
607 jsSubjectTransformConfig SubjectTransform;
608
611 jsStreamConsumerLimits ConsumerLimits;
612} jsStreamConfig;
613
617 typedef struct jsLostStreamData
618{
619 uint64_t *Msgs;
620 int MsgsLen;
621 uint64_t Bytes;
622
623} jsLostStreamData;
624
630 typedef struct jsStreamStateSubject
631{
632 const char *Subject;
633 uint64_t Msgs;
634
635} jsStreamStateSubject;
636
666 typedef struct jsStreamStateSubjects
667{
668 jsStreamStateSubject *List;
669 int Count;
670
671} jsStreamStateSubjects;
672
679 typedef struct jsStreamState
680{
681 uint64_t Msgs;
682 uint64_t Bytes;
683 uint64_t FirstSeq;
684 int64_t FirstTime;
685 uint64_t LastSeq;
686 int64_t LastTime;
687 int64_t NumSubjects;
688 jsStreamStateSubjects *Subjects;
689 uint64_t NumDeleted;
690 uint64_t *Deleted;
691 int DeletedLen;
692 jsLostStreamData *Lost;
693 int64_t Consumers;
694
695} jsStreamState;
696
701 typedef struct jsPeerInfo
702{
703 char *Name;
704 bool Current;
705 bool Offline;
706 int64_t Active;
707 uint64_t Lag;
708
709} jsPeerInfo;
710
715 typedef struct jsClusterInfo
716{
717 char *Name;
718 char *Leader;
719 jsPeerInfo **Replicas;
720 int ReplicasLen;
721
722} jsClusterInfo;
723
727 typedef struct jsStreamSourceInfo
728{
729 char *Name;
730 jsExternalStream *External;
731 uint64_t Lag;
732 int64_t Active;
733 const char * FilterSubject;
734 jsSubjectTransformConfig *SubjectTransforms;
735 int SubjectTransformsLen;
736
737} jsStreamSourceInfo;
738
742 typedef struct jsStreamAlternate
743{
744 const char *Name;
745 const char *Domain;
746 const char *Cluster;
747
748} jsStreamAlternate;
749
756 typedef struct jsStreamInfo
757{
758 jsStreamConfig *Config;
759 int64_t Created;
760 jsStreamState State;
761 jsClusterInfo *Cluster;
762 jsStreamSourceInfo *Mirror;
763 jsStreamSourceInfo **Sources;
764 int SourcesLen;
765 jsStreamAlternate **Alternates;
766 int AlternatesLen;
767
768} jsStreamInfo;
769
777 typedef struct jsStreamInfoList
778{
779 jsStreamInfo **List;
780 int Count;
781
782} jsStreamInfoList;
783
791 typedef struct jsStreamNamesList
792{
793 char **List;
794 int Count;
795
796} jsStreamNamesList;
797
841 typedef struct jsConsumerConfig
842{
843 const char *Name;
844 const char *Durable;
845 const char *Description;
846 jsDeliverPolicy DeliverPolicy;
847 uint64_t OptStartSeq;
848 int64_t OptStartTime;
849 jsAckPolicy AckPolicy;
850 int64_t AckWait;
851 int64_t MaxDeliver;
852 int64_t *BackOff;
853 int BackOffLen;
854 const char *FilterSubject;
855 jsReplayPolicy ReplayPolicy;
856 uint64_t RateLimit;
857 const char *SampleFrequency;
858 int64_t MaxWaiting;
859 int64_t MaxAckPending;
860 bool FlowControl;
861 int64_t Heartbeat;
862 bool HeadersOnly;
863
864 // Pull based options.
865 int64_t MaxRequestBatch;
866 int64_t MaxRequestExpires;
867 int64_t MaxRequestMaxBytes;
868
869 // Push based options.
870 const char *DeliverSubject;
871 const char *DeliverGroup;
872
873 // Ephemeral inactivity threshold.
874 int64_t InactiveThreshold;
875
876 // Generally inherited by parent stream and other markers, now can be configured directly.
877 int64_t Replicas;
878 // Force memory storage.
879 bool MemoryStorage;
880
881 // Configuration options introduced in 2.10
882
883 const char **FilterSubjects;
884 int FilterSubjectsLen;
885 natsMetadata Metadata;
886
887 // Configuration options introduced in 2.11
888
889 int64_t PauseUntil;
890} jsConsumerConfig;
891
909 typedef struct jsConsumerSequenceMismatch
910{
911 uint64_t Stream;
912 uint64_t ConsumerClient;
913 uint64_t ConsumerServer;
914
915} jsConsumerSequenceMismatch;
916
932 typedef struct jsSubOptions
933{
940 const char *Stream;
950 const char *Consumer;
965 const char *Queue;
978 bool ManualAck;
983 jsConsumerConfig Config;
990 bool Ordered;
991
992} jsSubOptions;
993
997 typedef struct jsSequencePair
998{
999 uint64_t Consumer;
1000 uint64_t Stream;
1001
1002} jsSequencePair;
1003
1007 typedef struct jsSequenceInfo
1008{
1009 uint64_t Consumer;
1010 uint64_t Stream;
1011 int64_t Last;
1012
1013} jsSequenceInfo;
1014
1021 typedef struct jsConsumerInfo
1022{
1023 char *Stream;
1024 char *Name;
1025 int64_t Created;
1026 jsConsumerConfig *Config;
1027 jsSequenceInfo Delivered;
1028 jsSequenceInfo AckFloor;
1029 int64_t NumAckPending;
1030 int64_t NumRedelivered;
1031 int64_t NumWaiting;
1032 uint64_t NumPending;
1033 jsClusterInfo *Cluster;
1034 bool PushBound;
1035 bool Paused;
1036 int64_t PauseRemaining;
1037} jsConsumerInfo;
1038
1046 typedef struct jsConsumerInfoList
1047{
1048 jsConsumerInfo **List;
1049 int Count;
1050
1051} jsConsumerInfoList;
1052
1060 typedef struct jsConsumerNamesList
1061{
1062 char **List;
1063 int Count;
1064
1065} jsConsumerNamesList;
1066
1072 typedef struct jsConsumerPauseResponse
1073{
1074 bool Paused;
1075 int64_t PauseUntil;
1076 int64_t PauseRemaining;
1077} jsConsumerPauseResponse;
1078
1082 typedef struct jsAPIStats
1083{
1084 uint64_t Total;
1085 uint64_t Errors;
1086
1087} jsAPIStats;
1088
1092 typedef struct jsAccountLimits
1093{
1094 int64_t MaxMemory;
1095 int64_t MaxStore;
1096 int64_t MaxStreams;
1097 int64_t MaxConsumers;
1098 int64_t MaxAckPending;
1099 int64_t MemoryMaxStreamBytes;
1100 int64_t StoreMaxStreamBytes;
1101 bool MaxBytesRequired;
1102
1103} jsAccountLimits;
1104
1105 typedef struct jsTier
1106{
1107 const char *Name;
1108 uint64_t Memory;
1109 uint64_t Store;
1110 int64_t Streams;
1111 int64_t Consumers;
1112 jsAccountLimits Limits;
1113
1114} jsTier;
1115
1119 typedef struct jsAccountInfo
1120{
1121 uint64_t Memory;
1122 uint64_t Store;
1123 int64_t Streams;
1124 int64_t Consumers;
1125 char *Domain;
1126 jsAPIStats API;
1127 jsAccountLimits Limits;
1128 jsTier **Tiers;
1129 int TiersLen;
1130
1131} jsAccountInfo;
1132
1140 typedef struct jsMsgMetaData
1141{
1142 jsSequencePair Sequence;
1143 uint64_t NumDelivered;
1144 uint64_t NumPending;
1145 int64_t Timestamp;
1146 char *Stream;
1147 char *Consumer;
1148 char *Domain;
1149
1150} jsMsgMetaData;
1151
1155 typedef struct jsPubAck
1156{
1157 char *Stream;
1158 uint64_t Sequence;
1159 char *Domain;
1160 bool Duplicate;
1161
1162} jsPubAck;
1163
1168 typedef struct jsPubAckErr
1169{
1170 natsMsg *Msg;
1171 natsStatus Err;
1172 jsErrCode ErrCode;
1173 const char *ErrText;
1174
1175} jsPubAckErr;
1176
1177#ifndef BUILD_IN_DOXYGEN
1178// Forward declarations
1179typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
1180typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
1181#endif
1182
1192 typedef struct jsDirectGetMsgOptions
1193{
1194 uint64_t Sequence;
1195 const char *NextBySubject;
1196 const char *LastBySubject;
1197
1198} jsDirectGetMsgOptions;
1199
1205 typedef struct jsFetchRequest
1206{
1207 int64_t Expires;
1208 int Batch;
1209 int64_t MaxBytes;
1210 bool NoWait;
1211 int64_t Heartbeat;
1212
1213} jsFetchRequest;
1214
1236 typedef void (*jsFetchCompleteHandler)(natsConnection *nc, natsSubscription *sub, natsStatus s, void *closure);
1237
1248 typedef bool (*jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure);
1249
1255 typedef struct jsOptionsPullSubscribeAsync
1256{
1257 int64_t Timeout;
1258 int MaxMessages;
1259 int64_t MaxBytes;
1260
1268 bool NoWait;
1269
1273 jsFetchCompleteHandler CompleteHandler;
1274 void *CompleteHandlerClosure;
1275
1278 int64_t Heartbeat;
1279
1283 int FetchSize;
1284
1291 int KeepAhead;
1292
1298 jsFetchNextHandler NextHandler;
1299 void *NextHandlerClosure;
1300
1301} jsOptionsPullSubscribeAsync;
1302
1308 typedef struct jsOptionsPublishAsync
1309{
1310 int64_t MaxPending;
1311
1312 // If jsPubAckHandler is specified, the callback will be invoked
1313 // for every asynchronous published message, either as a positive
1314 // result, or with the error encountered when publishing that
1315 // message. If this callback is specified, ErrHandler (see below)
1316 // will be ignored.
1317 jsPubAckHandler AckHandler;
1318 void *AckHandlerClosure;
1319
1320 // This callback is invoked for messages published asynchronously
1321 // when an error is returned by the server or if the library has
1322 // timed-out waiting for an acknowledgment back from the server
1323 // (if publish uses the jsPubOptions.MaxWait).
1324 jsPubAckErrHandler ErrHandler;
1325 void *ErrHandlerClosure;
1326
1327 int64_t StallWait;
1328
1329} jsOptionsPublishAsync;
1330
1340 typedef struct jsOptionsStreamPurge
1341{
1342 const char *Subject;
1343 uint64_t Sequence;
1344 uint64_t Keep;
1345
1346} jsOptionsStreamPurge;
1347
1351 typedef struct jsOptionsStreamInfo
1352{
1353 bool DeletedDetails;
1354 const char *SubjectsFilter;
1355
1356} jsOptionsStreamInfo;
1357
1364 typedef struct jsOptionsStream
1365{
1366 jsOptionsStreamPurge Purge;
1367 jsOptionsStreamInfo Info;
1368
1369} jsOptionsStream;
1370
1376 typedef struct jsOptions
1377{
1378 const char *Prefix;
1379 const char *Domain;
1380 int64_t Wait;
1381 jsOptionsPublishAsync PublishAsync;
1382 jsOptionsPullSubscribeAsync PullSubscribeAsync;
1383 jsOptionsStream Stream;
1384
1385} jsOptions;
1386
1390 typedef struct __kvStore kvStore;
1391
1395 typedef struct __kvEntry kvEntry;
1396
1400 typedef struct __kvStatus kvStatus;
1401
1405 typedef struct __kvWatcher kvWatcher;
1406
1410 typedef enum
1411{
1412 kvOp_Unknown = 0,
1413 kvOp_Put,
1414 kvOp_Delete,
1415 kvOp_Purge,
1416
1417} kvOperation;
1418
1424 typedef struct kvConfig
1425{
1426 const char *Bucket;
1427 const char *Description;
1428 int32_t MaxValueSize;
1429 uint8_t History;
1430 int64_t TTL;
1431 int64_t MaxBytes;
1432 jsStorageType StorageType;
1433 int Replicas;
1434 jsRePublish *RePublish;
1435 jsStreamSource *Mirror;
1436 jsStreamSource **Sources;
1437 int SourcesLen;
1438
1439} kvConfig;
1440
1446 typedef struct kvWatchOptions
1447{
1448 bool IgnoreDeletes;
1449 bool IncludeHistory;
1450 bool MetaOnly;
1451 int64_t Timeout;
1452 bool UpdatesOnly;
1453
1454} kvWatchOptions;
1455
1461 typedef struct kvPurgeOptions
1462{
1463 // How long to wait (in milliseconds) for some operations to complete.
1464 int64_t Timeout;
1465
1466 // When calling kvStore_PurgeDeletes(), all keys that have a delete or
1467 // purge marker as the last entry are gathered and then those keys
1468 // are purged of their content, including the marker.
1469 // Starting with NATS C client v3.3.0, if this option is not specified,
1470 // only the markers older than 30 minutes will be deleted. Use this
1471 // option to set the limit or a negative value to force removal of
1472 // markers regardless of their age.
1473 // The value is expressed as a time in nanoseconds.
1474 int64_t DeleteMarkersOlderThan;
1475
1476} kvPurgeOptions;
1477
1495 typedef struct kvEntryList
1496{
1497 kvEntry **Entries;
1498 int Count;
1499
1500} kvEntryList;
1501
1519 typedef struct kvKeysList
1520{
1521 char **Keys;
1522 int Count;
1523
1524} kvKeysList;
1525
1526#if defined(NATS_HAS_STREAMING)
1531 typedef struct __stanConnection stanConnection;
1532
1537 typedef struct __stanSubscription stanSubscription;
1538
1543 typedef struct __stanMsg stanMsg;
1544
1549 typedef struct __stanConnOptions stanConnOptions;
1550
1555 typedef struct __stanSubOptions stanSubOptions;
1556#endif
1557
// end of typesGroup
1559
1560//
1561// Callbacks.
1562//
1563
1586 typedef void (*natsMsgHandler)(
1587 natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure);
1588
1602 typedef void (*natsConnectionHandler)(
1603 natsConnection *nc, void *closure);
1604
1611 typedef void (*natsErrHandler)(
1612 natsConnection *nc, natsSubscription *subscription, natsStatus err,
1613 void *closure);
1614
1628 typedef natsStatus (*natsEvLoop_Attach)(
1629 void **userData,
1630 void *loop,
1631 natsConnection *nc,
1632 natsSock socket);
1633
1643 typedef natsStatus (*natsEvLoop_ReadAddRemove)(
1644 void *userData,
1645 bool add);
1646
1656 typedef natsStatus (*natsEvLoop_WriteAddRemove)(
1657 void *userData,
1658 bool add);
1659
1667 typedef natsStatus (*natsEvLoop_Detach)(
1668 void *userData);
1669
1691 typedef natsStatus (*natsUserJWTHandler)(
1692 char **userJWT,
1693 char **customErrTxt,
1694 void *closure);
1695
1696
1722 typedef natsStatus (*natsSignatureHandler)(
1723 char **customErrTxt,
1724 unsigned char **signature,
1725 int *signatureLength,
1726 const char *nonce,
1727 void *closure);
1728
1737 typedef const char* (*natsTokenHandler)(void *closure);
1738
1739
1747 typedef void (*natsOnCompleteCB)(void *closure);
1748
1769 typedef int64_t (*natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure);
1770
1771#ifdef BUILD_IN_DOXYGEN
1805 typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
1806
1848 typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
1849#endif
1850
1851#if defined(NATS_HAS_STREAMING)
1860 typedef void (*stanPubAckHandler)(const char *guid, const char *error, void *closure);
1861
1871 typedef void (*stanMsgHandler)(
1872 stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure);
1873
1880 typedef void (*stanConnectionLostHandler)(
1881 stanConnection *sc, const char* errorTxt, void *closure);
1882#endif
1883
// end of callbacksGroup
1885
1886//
1887// Functions.
1888//
1915 NATS_EXTERN natsStatus
1916nats_OpenWithConfig(natsClientConfig *config);
1917
1931 NATS_EXTERN natsStatus
1932nats_Open(int64_t lockSpinCount);
1933
1934
1939 NATS_EXTERN const char*
1940nats_GetVersion(void);
1941
1949 NATS_EXTERN uint32_t
1950nats_GetVersionNumber(void);
1951
1952#ifdef BUILD_IN_DOXYGEN
1967 NATS_EXTERN bool
1968nats_CheckCompatibility(void);
1969#else
1970
1971#define nats_CheckCompatibility() nats_CheckCompatibilityImpl(NATS_VERSION_REQUIRED_NUMBER, \
1972 NATS_VERSION_NUMBER, \
1973 NATS_VERSION_STRING)
1974
1975 NATS_EXTERN bool
1976nats_CheckCompatibilityImpl(uint32_t reqVerNumber, uint32_t verNumber, const char *verString);
1977
1978#endif
1979
1984 NATS_EXTERN int64_t
1985nats_Now(void);
1986
1992 NATS_EXTERN int64_t
1993nats_NowInNanoSeconds(void);
1994
2002 NATS_EXTERN void
2003nats_Sleep(int64_t sleepTime);
2004
2017 NATS_EXTERN const char*
2018nats_GetLastError(natsStatus *status);
2019
2028 NATS_EXTERN natsStatus
2029nats_GetLastErrorStack(char *buffer, size_t bufLen);
2030
2051 NATS_EXTERN void
2052nats_PrintLastErrorStack(FILE *file);
2053
2083 NATS_EXTERN natsStatus
2084nats_SetMessageDeliveryPoolSize(int max);
2085
2096 NATS_EXTERN void
2097nats_ReleaseThreadMemory(void);
2098
2123 NATS_EXTERN natsStatus
2124nats_Sign(const char *encodedSeed,
2125 const char *input,
2126 unsigned char **signature,
2127 int *signatureLength);
2128
2149 NATS_EXTERN void
2150nats_Close(void);
2151
2197 NATS_EXTERN natsStatus
2198nats_CloseAndWait(int64_t timeout);
2199
// end of libraryGroup
2201
2217 NATS_EXTERN const char*
2218natsStatus_GetText(natsStatus s);
2219
// end of statusGroup
2221
2239 NATS_EXTERN natsStatus
2240natsStatistics_Create(natsStatistics **newStats);
2241
2258 NATS_EXTERN natsStatus
2259natsStatistics_GetCounts(const natsStatistics *stats,
2260 uint64_t *inMsgs, uint64_t *inBytes,
2261 uint64_t *outMsgs, uint64_t *outBytes,
2262 uint64_t *reconnects);
2263
2270 NATS_EXTERN void
2271natsStatistics_Destroy(natsStatistics *stats);
2272
// end of statsGroup
2274
2299 NATS_EXTERN natsStatus
2300natsOptions_Create(natsOptions **newOpts);
2301
2323/*
2324 * The above is for doxygen. The proper syntax for username/password
2325 * is without the '\' character:
2326 *
2327 * nats://localhost:4222
2328 * nats://user@localhost:4222
2329 * nats://user:password@localhost:4222
2330 */
2331 NATS_EXTERN natsStatus
2332natsOptions_SetURL(natsOptions *opts, const char *url);
2333
2348 NATS_EXTERN natsStatus
2349natsOptions_SetServers(natsOptions *opts, const char** servers, int serversCount);
2350
2376 NATS_EXTERN natsStatus
2377natsOptions_SetUserInfo(natsOptions *opts, const char *user, const char *password);
2378
2403 NATS_EXTERN natsStatus
2404natsOptions_SetToken(natsOptions *opts, const char *token);
2405
2421 NATS_EXTERN natsStatus
2422natsOptions_SetTokenHandler(natsOptions *opts, natsTokenHandler tokenCb,
2423 void *closure);
2424
2434 NATS_EXTERN natsStatus
2435natsOptions_SetNoRandomize(natsOptions *opts, bool noRandomize);
2436
2449 NATS_EXTERN natsStatus
2450natsOptions_SetTimeout(natsOptions *opts, int64_t timeout);
2451
2459 NATS_EXTERN natsStatus
2460natsOptions_SetName(natsOptions *opts, const char *name);
2461
2471 NATS_EXTERN natsStatus
2472natsOptions_SetSecure(natsOptions *opts, bool secure);
2473
2488 NATS_EXTERN natsStatus
2489natsOptions_TLSHandshakeFirst(natsOptions *opts);
2490
2504 NATS_EXTERN natsStatus
2505natsOptions_LoadCATrustedCertificates(natsOptions *opts, const char *fileName);
2506
2532 NATS_EXTERN natsStatus
2533natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates);
2534
2549 NATS_EXTERN natsStatus
2550natsOptions_LoadCertificatesChain(natsOptions *opts,
2551 const char *certsFileName,
2552 const char *keyFileName);
2553
2565 NATS_EXTERN natsStatus
2566natsOptions_SetCertificatesChain(natsOptions *opts,
2567 const char *cert,
2568 const char *key);
2569
2585 NATS_EXTERN natsStatus
2586natsOptions_SetCiphers(natsOptions *opts, const char *ciphers);
2587
2601 NATS_EXTERN natsStatus
2602natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers);
2603
2613 NATS_EXTERN natsStatus
2614natsOptions_SetExpectedHostname(natsOptions *opts, const char *hostname);
2615
2628 NATS_EXTERN natsStatus
2629natsOptions_SkipServerVerification(natsOptions *opts, bool skip);
2630
2640 NATS_EXTERN natsStatus
2641natsOptions_SetSSLVerificationCallback(natsOptions *opts, SSL_verify_cb callback);
2642
2653 NATS_EXTERN natsStatus
2654natsOptions_SetVerbose(natsOptions *opts, bool verbose);
2655
2666 NATS_EXTERN natsStatus
2667natsOptions_SetPedantic(natsOptions *opts, bool pedantic);
2668
2678 NATS_EXTERN natsStatus
2679natsOptions_SetPingInterval(natsOptions *opts, int64_t interval);
2680
2692 NATS_EXTERN natsStatus
2693natsOptions_SetMaxPingsOut(natsOptions *opts, int maxPingsOut);
2694
2706 NATS_EXTERN natsStatus
2707natsOptions_SetIOBufSize(natsOptions *opts, int ioBufSize);
2708
2720 NATS_EXTERN natsStatus
2721natsOptions_SetAllowReconnect(natsOptions *opts, bool allow);
2722
2730 NATS_EXTERN natsStatus
2731natsOptions_SetMaxReconnect(natsOptions *opts, int maxReconnect);
2732
2746 NATS_EXTERN natsStatus
2747natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait);
2748
2772 NATS_EXTERN natsStatus
2773natsOptions_SetReconnectJitter(natsOptions *opts, int64_t jitter, int64_t jitterTLS);
2774
2793 NATS_EXTERN natsStatus
2794natsOptions_SetCustomReconnectDelay(natsOptions *opts,
2795 natsCustomReconnectDelayHandler cb,
2796 void *closure);
2797
2810 NATS_EXTERN natsStatus
2811natsOptions_SetReconnectBufSize(natsOptions *opts, int reconnectBufSize);
2812
2826 NATS_EXTERN natsStatus
2827natsOptions_SetMaxPendingMsgs(natsOptions *opts, int maxPending);
2828
2842 NATS_EXTERN natsStatus
2843natsOptions_SetMaxPendingBytes(natsOptions* opts, int64_t maxPending);
2844
2859 NATS_EXTERN natsStatus
2860natsOptions_SetErrorHandler(natsOptions *opts, natsErrHandler errHandler,
2861 void *closure);
2862
2875 NATS_EXTERN natsStatus
2876natsOptions_SetClosedCB(natsOptions *opts, natsConnectionHandler closedCb,
2877 void *closure);
2878
2895 NATS_EXTERN natsStatus
2896natsOptions_SetDisconnectedCB(natsOptions *opts,
2897 natsConnectionHandler disconnectedCb,
2898 void *closure);
2899
2915 NATS_EXTERN natsStatus
2916natsOptions_SetReconnectedCB(natsOptions *opts,
2917 natsConnectionHandler reconnectedCb,
2918 void *closure);
2919
2934 NATS_EXTERN natsStatus
2935natsOptions_SetDiscoveredServersCB(natsOptions *opts,
2936 natsConnectionHandler discoveredServersCb,
2937 void *closure);
2938
2952 NATS_EXTERN natsStatus
2953natsOptions_SetIgnoreDiscoveredServers(natsOptions *opts, bool ignore);
2954
2971 NATS_EXTERN natsStatus
2972natsOptions_SetLameDuckModeCB(natsOptions *opts,
2973 natsConnectionHandler lameDuckCb,
2974 void *closure);
2975
2993 NATS_EXTERN natsStatus
2994natsOptions_SetEventLoop(natsOptions *opts,
2995 void *loop,
2996 natsEvLoop_Attach attachCb,
2997 natsEvLoop_ReadAddRemove readCb,
2998 natsEvLoop_WriteAddRemove writeCb,
2999 natsEvLoop_Detach detachCb);
3000
3023 NATS_EXTERN natsStatus
3024natsOptions_UseGlobalMessageDelivery(natsOptions *opts, bool global);
3025
3048 NATS_EXTERN natsStatus
3049natsOptions_IPResolutionOrder(natsOptions *opts, int order);
3050
3078 NATS_EXTERN natsStatus
3079natsOptions_SetSendAsap(natsOptions *opts, bool sendAsap);
3080
3090 NATS_EXTERN natsStatus
3091natsOptions_UseOldRequestStyle(natsOptions *opts, bool useOldStyle);
3092
3107 NATS_EXTERN natsStatus
3108natsOptions_SetFailRequestsOnDisconnect(natsOptions *opts, bool failRequests);
3109
3128 NATS_EXTERN natsStatus
3129natsOptions_SetNoEcho(natsOptions *opts, bool noEcho);
3130
3184 NATS_EXTERN natsStatus
3185natsOptions_SetRetryOnFailedConnect(natsOptions *opts, bool retry,
3186 natsConnectionHandler connectedCb, void* closure);
3187
3216 NATS_EXTERN natsStatus
3217natsOptions_SetUserCredentialsCallbacks(natsOptions *opts,
3218 natsUserJWTHandler ujwtCB,
3219 void *ujwtClosure,
3220 natsSignatureHandler sigCB,
3221 void *sigClosure);
3222
3261 NATS_EXTERN natsStatus
3262natsOptions_SetUserCredentialsFromFiles(natsOptions *opts,
3263 const char *userOrChainedFile,
3264 const char *seedFile);
3265
3278 NATS_EXTERN natsStatus
3279natsOptions_SetUserCredentialsFromMemory(natsOptions *opts,
3280 const char *jwtAndSeedContent);
3281
3305 NATS_EXTERN natsStatus
3306natsOptions_SetNKey(natsOptions *opts,
3307 const char *pubKey,
3308 natsSignatureHandler sigCB,
3309 void *sigClosure);
3310
3335 NATS_EXTERN natsStatus
3336natsOptions_SetNKeyFromSeed(natsOptions *opts,
3337 const char *pubKey,
3338 const char *seedFile);
3339
3353 NATS_EXTERN natsStatus
3354natsOptions_SetWriteDeadline(natsOptions *opts, int64_t deadline);
3355
3390 NATS_EXTERN natsStatus
3391natsOptions_DisableNoResponders(natsOptions *opts, bool disabled);
3392
3408 NATS_EXTERN natsStatus
3409natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix);
3410
3424 NATS_EXTERN natsStatus
3425natsOptions_SetMessageBufferPadding(natsOptions *opts, int paddingSize);
3426
3434 NATS_EXTERN void
3435natsOptions_Destroy(natsOptions *opts);
3436
// end of optsGroup
3438
3439#if defined(NATS_HAS_STREAMING)
3473 NATS_EXTERN natsStatus
3474stanConnOptions_Create(stanConnOptions **newOpts);
3475
3497 NATS_EXTERN natsStatus
3498stanConnOptions_SetURL(stanConnOptions *opts, const char *url);
3499
3516 NATS_EXTERN natsStatus
3517stanConnOptions_SetNATSOptions(stanConnOptions *opts, natsOptions *nOpts);
3518
3528 NATS_EXTERN natsStatus
3529stanConnOptions_SetConnectionWait(stanConnOptions *opts, int64_t wait);
3530
3540 NATS_EXTERN natsStatus
3541stanConnOptions_SetPubAckWait(stanConnOptions *opts, int64_t wait);
3542
3550 NATS_EXTERN natsStatus
3551stanConnOptions_SetDiscoveryPrefix(stanConnOptions *opts, const char *prefix);
3552
3553
3568 NATS_EXTERN natsStatus
3569stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage);
3570
3586 NATS_EXTERN natsStatus
3587stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut);
3588
3599 NATS_EXTERN natsStatus
3600stanConnOptions_SetConnectionLostHandler(stanConnOptions *opts, stanConnectionLostHandler handler, void *closure);
3601
3609 NATS_EXTERN void
3610stanConnOptions_Destroy(stanConnOptions *opts);
3611
// end of stanConnOptsGroup
3613
3644 NATS_EXTERN natsStatus
3645stanSubOptions_Create(stanSubOptions **newOpts);
3646
3665 NATS_EXTERN natsStatus
3666stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName);
3667
3681 NATS_EXTERN natsStatus
3682stanSubOptions_SetAckWait(stanSubOptions *opts, int64_t wait);
3683
3695 NATS_EXTERN natsStatus
3696stanSubOptions_SetMaxInflight(stanSubOptions *opts, int maxInflight);
3697
3713 NATS_EXTERN natsStatus
3714stanSubOptions_StartAtSequence(stanSubOptions *opts, uint64_t seq);
3715
3730 NATS_EXTERN natsStatus
3731stanSubOptions_StartAtTime(stanSubOptions *opts, int64_t time);
3732
3744 NATS_EXTERN natsStatus
3745stanSubOptions_StartAtTimeDelta(stanSubOptions *opts, int64_t delta);
3746
3755 NATS_EXTERN natsStatus
3756stanSubOptions_StartWithLastReceived(stanSubOptions *opts);
3757
3765 NATS_EXTERN natsStatus
3766stanSubOptions_DeliverAllAvailable(stanSubOptions *opts);
3767
3782 NATS_EXTERN natsStatus
3783stanSubOptions_SetManualAckMode(stanSubOptions *opts, bool manual);
3784
3792 NATS_EXTERN void
3793stanSubOptions_Destroy(stanSubOptions *opts);
3794
// end of stanSubOptsGroup
3796#endif
3797
3817 NATS_EXTERN natsStatus
3818natsInbox_Create(natsInbox **newInbox);
3819
3826 NATS_EXTERN void
3827natsInbox_Destroy(natsInbox *inbox);
3828
// end of inboxGroup
3830
3849 NATS_EXTERN void
3850natsMsgList_Destroy(natsMsgList *list);
3851
3869 NATS_EXTERN natsStatus
3870natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply,
3871 const char *data, int dataLen);
3872
3881 NATS_EXTERN const char*
3882natsMsg_GetSubject(const natsMsg *msg);
3883
3893 NATS_EXTERN const char*
3894natsMsg_GetReply(const natsMsg *msg);
3895
3911 NATS_EXTERN const char*
3912natsMsg_GetData(const natsMsg *msg);
3913
3920 NATS_EXTERN int
3921natsMsg_GetDataLength(const natsMsg *msg);
3922
3938 NATS_EXTERN natsStatus
3939natsMsgHeader_Set(natsMsg *msg, const char *key, const char *value);
3940
3956 NATS_EXTERN natsStatus
3957natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value);
3958
3977 NATS_EXTERN natsStatus
3978natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value);
3979
4013 NATS_EXTERN natsStatus
4014natsMsgHeader_Values(natsMsg *msg, const char *key, const char* **values, int *count);
4015
4045 NATS_EXTERN natsStatus
4046natsMsgHeader_Keys(natsMsg *msg, const char* **keys, int *count);
4047
4061 NATS_EXTERN natsStatus
4062natsMsgHeader_Delete(natsMsg *msg, const char *key);
4063
4089 NATS_EXTERN bool
4090natsMsg_IsNoResponders(natsMsg *msg);
4091
4098 NATS_EXTERN void
4099natsMsg_Destroy(natsMsg *msg);
4100
// end of msgGroup
4102
4103#if defined(NATS_HAS_STREAMING)
4116 NATS_EXTERN uint64_t
4117stanMsg_GetSequence(const stanMsg *msg);
4118
4125 NATS_EXTERN int64_t
4126stanMsg_GetTimestamp(const stanMsg *msg);
4127
4136 NATS_EXTERN bool
4137stanMsg_IsRedelivered(const stanMsg *msg);
4138
4154 NATS_EXTERN const char*
4155stanMsg_GetData(const stanMsg *msg);
4156
4163 NATS_EXTERN int
4164stanMsg_GetDataLength(const stanMsg *msg);
4165
4172 NATS_EXTERN void
4173stanMsg_Destroy(stanMsg *msg);
4174
// end of stanMsgGroup
4176#endif
4177
4208 NATS_EXTERN natsStatus
4209natsConnection_Connect(natsConnection **nc, natsOptions *options);
4210
4220 NATS_EXTERN natsStatus
4221natsConnection_Reconnect(natsConnection *nc);
4222
4233 NATS_EXTERN void
4234natsConnection_ProcessReadEvent(natsConnection *nc);
4235
4247 NATS_EXTERN void
4248natsConnection_ProcessCloseEvent(natsSock *socket);
4249
4260 NATS_EXTERN void
4261natsConnection_ProcessWriteEvent(natsConnection *nc);
4262
4281 NATS_EXTERN natsStatus
4282natsConnection_ConnectTo(natsConnection **nc, const char *urls);
4283
4290 NATS_EXTERN bool
4291natsConnection_IsClosed(natsConnection *nc);
4292
4299 NATS_EXTERN bool
4300natsConnection_IsReconnecting(natsConnection *nc);
4301
4308 NATS_EXTERN bool
4309natsConnection_IsDraining(natsConnection *nc);
4310
4319 NATS_EXTERN natsConnStatus
4320natsConnection_Status(natsConnection *nc);
4321
4333 NATS_EXTERN int
4334natsConnection_Buffered(natsConnection *nc);
4335
4351 NATS_EXTERN natsStatus
4352natsConnection_Flush(natsConnection *nc);
4353
4366 NATS_EXTERN natsStatus
4367natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout);
4368
4378 NATS_EXTERN int64_t
4379natsConnection_GetMaxPayload(natsConnection *nc);
4380
4390 NATS_EXTERN natsStatus
4391natsConnection_GetStats(natsConnection *nc, natsStatistics *stats);
4392
4402 NATS_EXTERN natsStatus
4403natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize);
4404
4414 NATS_EXTERN natsStatus
4415natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize);
4416
4437 NATS_EXTERN natsStatus
4438natsConnection_GetServers(natsConnection *nc, char ***servers, int *count);
4439
4460 NATS_EXTERN natsStatus
4461natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count);
4462
4479 NATS_EXTERN natsStatus
4480natsConnection_GetLastError(natsConnection *nc, const char **lastError);
4481
4504 NATS_EXTERN natsStatus
4505natsConnection_ReadLastError(natsConnection *nc, char *buf, size_t n);
4506
4520 NATS_EXTERN natsStatus
4521natsConnection_GetClientID(natsConnection *nc, uint64_t *cid);
4522
4541 NATS_EXTERN natsStatus
4542natsConnection_Drain(natsConnection *nc);
4543
4561 NATS_EXTERN natsStatus
4562natsConnection_DrainTimeout(natsConnection *nc, int64_t timeout);
4563
4576 NATS_EXTERN natsStatus
4577natsConnection_Sign(natsConnection *nc,
4578 const unsigned char *message, int messageLen,
4579 unsigned char sig[64]);
4580
4599 NATS_EXTERN natsStatus
4600natsConnection_GetClientIP(natsConnection *nc, char **ip);
4601
4612 NATS_EXTERN natsStatus
4613natsConnection_GetRTT(natsConnection *nc, int64_t *rtt);
4614
4622 NATS_EXTERN natsStatus
4623natsConnection_HasHeaderSupport(natsConnection *nc);
4624
4644 NATS_EXTERN natsStatus
4645natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port);
4646
4656 NATS_EXTERN void
4657natsConnection_Close(natsConnection *nc);
4658
4666 NATS_EXTERN void
4667natsConnection_Destroy(natsConnection *nc);
4668
// end of connMgtGroup
4670
4687 NATS_EXTERN natsStatus
4688natsConnection_Publish(natsConnection *nc, const char *subj,
4689 const void *data, int dataLen);
4690
4705 NATS_EXTERN natsStatus
4706natsConnection_PublishString(natsConnection *nc, const char *subj,
4707 const char *str);
4708
4719 NATS_EXTERN natsStatus
4720natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg);
4721
4734 NATS_EXTERN natsStatus
4735natsConnection_PublishRequest(natsConnection *nc, const char *subj,
4736 const char *reply, const void *data, int dataLen);
4737
4754 NATS_EXTERN natsStatus
4755natsConnection_PublishRequestString(natsConnection *nc, const char *subj,
4756 const char *reply, const char *str);
4757
4775 NATS_EXTERN natsStatus
4776natsConnection_Request(natsMsg **replyMsg, natsConnection *nc, const char *subj,
4777 const void *data, int dataLen, int64_t timeout);
4778
4800 NATS_EXTERN natsStatus
4801natsConnection_RequestString(natsMsg **replyMsg, natsConnection *nc,
4802 const char *subj, const char *str,
4803 int64_t timeout);
4804
4819 NATS_EXTERN natsStatus
4820natsConnection_RequestMsg(natsMsg **replyMsg, natsConnection *nc,
4821 natsMsg *requestMsg, int64_t timeout);
4822
// end of connPubGroup
4824
4845 NATS_EXTERN natsStatus
4846natsConnection_Subscribe(natsSubscription **sub, natsConnection *nc,
4847 const char *subject, natsMsgHandler cb,
4848 void *cbClosure);
4849
4880 NATS_EXTERN natsStatus
4881natsConnection_SubscribeTimeout(natsSubscription **sub, natsConnection *nc,
4882 const char *subject, int64_t timeout,
4883 natsMsgHandler cb, void *cbClosure);
4884
4895 NATS_EXTERN natsStatus
4896natsConnection_SubscribeSync(natsSubscription **sub, natsConnection *nc,
4897 const char *subject);
4898
4916 NATS_EXTERN natsStatus
4917natsConnection_QueueSubscribe(natsSubscription **sub, natsConnection *nc,
4918 const char *subject, const char *queueGroup,
4919 natsMsgHandler cb, void *cbClosure);
4920
4953 NATS_EXTERN natsStatus
4954natsConnection_QueueSubscribeTimeout(natsSubscription **sub, natsConnection *nc,
4955 const char *subject, const char *queueGroup,
4956 int64_t timeout, natsMsgHandler cb, void *cbClosure);
4957
4969 NATS_EXTERN natsStatus
4970natsConnection_QueueSubscribeSync(natsSubscription **sub, natsConnection *nc,
4971 const char *subject, const char *queueGroup);
4972
// end of connSubGroup
4974
// end of connGroup
4976
4995 NATS_EXTERN natsStatus
4996natsSubscription_NoDeliveryDelay(natsSubscription *sub);
4997
5020 NATS_EXTERN natsStatus
5021natsSubscription_NextMsg(natsMsg **nextMsg, natsSubscription *sub,
5022 int64_t timeout);
5023
5032 NATS_EXTERN natsStatus
5033natsSubscription_Unsubscribe(natsSubscription *sub);
5034
5046 NATS_EXTERN natsStatus
5047natsSubscription_AutoUnsubscribe(natsSubscription *sub, int max);
5048
5058 NATS_EXTERN natsStatus
5059natsSubscription_QueuedMsgs(natsSubscription *sub, uint64_t *queuedMsgs);
5060
5069 NATS_EXTERN int64_t
5070natsSubscription_GetID(natsSubscription* sub);
5071
5082 NATS_EXTERN const char*
5083natsSubscription_GetSubject(natsSubscription* sub);
5084
5105 NATS_EXTERN natsStatus
5106natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit);
5107
5127 NATS_EXTERN natsStatus
5128natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit);
5129
5144 NATS_EXTERN natsStatus
5145natsSubscription_GetPending(natsSubscription *sub, int *msgs, int *bytes);
5146
5155 NATS_EXTERN natsStatus
5156natsSubscription_GetDelivered(natsSubscription *sub, int64_t *msgs);
5157
5173 NATS_EXTERN natsStatus
5174natsSubscription_GetDropped(natsSubscription *sub, int64_t *msgs);
5175
5188 NATS_EXTERN natsStatus
5189natsSubscription_GetMaxPending(natsSubscription *sub, int *msgs, int *bytes);
5190
5197 NATS_EXTERN natsStatus
5198natsSubscription_ClearMaxPending(natsSubscription *sub);
5199
5226 NATS_EXTERN natsStatus
5227natsSubscription_GetStats(natsSubscription *sub,
5228 int *pendingMsgs,
5229 int *pendingBytes,
5230 int *maxPendingMsgs,
5231 int *maxPendingBytes,
5232 int64_t *deliveredMsgs,
5233 int64_t *droppedMsgs);
5234
5243 NATS_EXTERN bool
5244natsSubscription_IsValid(natsSubscription *sub);
5245
5263 NATS_EXTERN natsStatus
5264natsSubscription_Drain(natsSubscription *sub);
5265
5316 NATS_EXTERN natsStatus
5317natsSubscription_DrainTimeout(natsSubscription *sub, int64_t timeout);
5318
5341 NATS_EXTERN natsStatus
5342natsSubscription_WaitForDrainCompletion(natsSubscription *sub, int64_t timeout);
5343
5369 NATS_EXTERN natsStatus
5370natsSubscription_DrainCompletionStatus(natsSubscription *sub);
5371
5400 NATS_EXTERN natsStatus
5401natsSubscription_SetOnCompleteCB(natsSubscription *sub, natsOnCompleteCB cb, void *closure);
5402
5410 NATS_EXTERN void
5411natsSubscription_Destroy(natsSubscription *sub);
5412
// end of subGroup
5414
5415#if defined(NATS_HAS_STREAMING)
5456 NATS_EXTERN natsStatus
5457stanConnection_Connect(stanConnection **sc, const char *clusterID, const char *clientID,
5458 stanConnOptions *options);
5459
5482 NATS_EXTERN natsStatus
5483stanConnection_GetNATSConnection(stanConnection *sc, natsConnection **nc);
5484
5509 NATS_EXTERN void
5510stanConnection_ReleaseNATSConnection(stanConnection *sc);
5511
5522 NATS_EXTERN natsStatus
5523stanConnection_Close(stanConnection *sc);
5524
5532 NATS_EXTERN natsStatus
5533stanConnection_Destroy(stanConnection *sc);
5534
// end of stanConnMgtGroup
5536
5553 NATS_EXTERN natsStatus
5554stanConnection_Publish(stanConnection *sc, const char *channel,
5555 const void *data, int dataLen);
5556
5580 NATS_EXTERN natsStatus
5581stanConnection_PublishAsync(stanConnection *sc, const char *channel,
5582 const void *data, int dataLen,
5583 stanPubAckHandler ah, void *ahClosure);
5584
// end of stanConnPubGroup
5586
5609 NATS_EXTERN natsStatus
5610stanConnection_Subscribe(stanSubscription **sub, stanConnection *sc,
5611 const char *channel, stanMsgHandler cb,
5612 void *cbClosure, stanSubOptions *options);
5613
5633 NATS_EXTERN natsStatus
5634stanConnection_QueueSubscribe(stanSubscription **sub, stanConnection *sc,
5635 const char *channel, const char *queueGroup,
5636 stanMsgHandler cb, void *cbClosure, stanSubOptions *options);
5637
// end of stanConnSubGroup
5639
// end of stanConnGroup
5641
5670 NATS_EXTERN natsStatus
5671stanSubscription_SetOnCompleteCB(stanSubscription *sub, natsOnCompleteCB cb, void *closure);
5672
5682 NATS_EXTERN natsStatus
5683stanSubscription_AckMsg(stanSubscription *sub, stanMsg *msg);
5684
5704 NATS_EXTERN natsStatus
5705stanSubscription_Unsubscribe(stanSubscription *sub);
5706
5717 NATS_EXTERN natsStatus
5718stanSubscription_Close(stanSubscription *sub);
5719
5727 NATS_EXTERN void
5728stanSubscription_Destroy(stanSubscription *sub);
5729
// end of stanSubGroup
5731#endif
5732
5746 NATS_EXTERN natsStatus
5747jsOptions_Init(jsOptions *opts);
5748
5763 NATS_EXTERN natsStatus
5764natsConnection_JetStream(jsCtx **js, natsConnection *nc, jsOptions *opts);
5765
5772 NATS_EXTERN void
5773jsCtx_Destroy(jsCtx *js);
5774
5788 NATS_EXTERN natsStatus
5789jsStreamConfig_Init(jsStreamConfig *cfg);
5790
5797 NATS_EXTERN natsStatus
5798jsPlacement_Init(jsPlacement *placement);
5799
5806 NATS_EXTERN natsStatus
5807jsStreamSource_Init(jsStreamSource *source);
5808
5815 NATS_EXTERN natsStatus
5816jsExternalStream_Init(jsExternalStream *external);
5817
5824 NATS_EXTERN natsStatus
5825jsRePublish_Init(jsRePublish *rp);
5826
5846 NATS_EXTERN natsStatus
5847js_AddStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
5848
5868 NATS_EXTERN natsStatus
5869js_UpdateStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
5870
5893 NATS_EXTERN natsStatus
5894js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
5895
5906 NATS_EXTERN natsStatus
5907js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
5908
5926 NATS_EXTERN natsStatus
5927js_GetMsg(natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
5928
5946 NATS_EXTERN natsStatus
5947js_GetLastMsg(natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode);
5948
5956 NATS_EXTERN natsStatus
5957jsDirectGetMsgOptions_Init(jsDirectGetMsgOptions *opts);
5958
5981 NATS_EXTERN natsStatus
5982js_DirectGetMsg(natsMsg **msg, jsCtx *js, const char *stream, jsOptions *opts, jsDirectGetMsgOptions *dgOpts);
5983
6000 NATS_EXTERN natsStatus
6001js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
6002
6017 NATS_EXTERN natsStatus
6018js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
6019
6046 NATS_EXTERN natsStatus
6047js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
6048
6055 NATS_EXTERN void
6056jsStreamInfo_Destroy(jsStreamInfo *si);
6057
6072 NATS_EXTERN natsStatus
6073js_Streams(jsStreamInfoList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
6074
6084 NATS_EXTERN void
6085jsStreamInfoList_Destroy(jsStreamInfoList *list);
6086
6101 NATS_EXTERN natsStatus
6102js_StreamNames(jsStreamNamesList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
6103
6113 NATS_EXTERN void
6114jsStreamNamesList_Destroy(jsStreamNamesList *list);
6115
6124 NATS_EXTERN natsStatus
6125jsConsumerConfig_Init(jsConsumerConfig *cc);
6126
6146 NATS_EXTERN natsStatus
6147js_AddConsumer(jsConsumerInfo **ci, jsCtx *js,
6148 const char *stream, jsConsumerConfig *cfg,
6149 jsOptions *opts, jsErrCode *errCode);
6150
6170 NATS_EXTERN natsStatus
6171js_UpdateConsumer(jsConsumerInfo **ci, jsCtx *js,
6172 const char *stream, jsConsumerConfig *cfg,
6173 jsOptions *opts, jsErrCode *errCode);
6174
6188 NATS_EXTERN natsStatus
6189js_GetConsumerInfo(jsConsumerInfo **ci, jsCtx *js,
6190 const char *stream, const char *consumer,
6191 jsOptions *opts, jsErrCode *errCode);
6192
6204 NATS_EXTERN natsStatus
6205js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer,
6206 jsOptions *opts, jsErrCode *errCode);
6207
6222 NATS_EXTERN natsStatus
6223js_PauseConsumer(jsConsumerPauseResponse **new_cpr, jsCtx *js,
6224 const char *stream, const char *consumer,
6225 uint64_t pauseUntil, jsOptions *opts, jsErrCode *errCode);
6226
6233 NATS_EXTERN void
6234jsConsumerPauseResponse_Destroy(jsConsumerPauseResponse *cpr);
6235
6242 NATS_EXTERN void
6243jsConsumerInfo_Destroy(jsConsumerInfo *ci);
6244
6259 NATS_EXTERN natsStatus
6260js_Consumers(jsConsumerInfoList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
6261
6271 NATS_EXTERN void
6272jsConsumerInfoList_Destroy(jsConsumerInfoList *list);
6273
6288 NATS_EXTERN natsStatus
6289js_ConsumerNames(jsConsumerNamesList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
6290
6300 NATS_EXTERN void
6301jsConsumerNamesList_Destroy(jsConsumerNamesList *list);
6302
6317 NATS_EXTERN natsStatus
6318js_GetAccountInfo(jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
6319
6326 NATS_EXTERN void
6327jsAccountInfo_Destroy(jsAccountInfo *ai);
6328
// end of jsAssetsGroup
6330
6344 NATS_EXTERN natsStatus
6345jsPubOptions_Init(jsPubOptions *opts);
6346
6362 NATS_EXTERN natsStatus
6363js_Publish(jsPubAck **pubAck, jsCtx *js, const char *subj, const void *data, int dataLen,
6364 jsPubOptions *opts, jsErrCode *errCode);
6365
6385 NATS_EXTERN natsStatus
6386js_PublishMsg(jsPubAck **pubAck, jsCtx *js, natsMsg *msg,
6387 jsPubOptions *opts, jsErrCode *errCode);
6388
6395 NATS_EXTERN void
6396jsPubAck_Destroy(jsPubAck *pubAck);
6397
6408 NATS_EXTERN natsStatus
6409js_PublishAsync(jsCtx *js, const char *subj, const void *data, int dataLen,
6410 jsPubOptions *opts);
6411
6435 NATS_EXTERN natsStatus
6436js_PublishMsgAsync(jsCtx *js, natsMsg **msg, jsPubOptions *opts);
6437
6449 NATS_EXTERN natsStatus
6450js_PublishAsyncComplete(jsCtx *js, jsPubOptions *opts);
6451
6500 NATS_EXTERN natsStatus
6501js_PublishAsyncGetPendingList(natsMsgList *pending, jsCtx *js);
6502
// end of jsPubGroup
6504
6518 NATS_EXTERN natsStatus
6519jsSubOptions_Init(jsSubOptions *opts);
6520
6566 NATS_EXTERN natsStatus
6567js_Subscribe(natsSubscription **sub, jsCtx *js, const char *subject,
6568 natsMsgHandler cb, void* cbClosure,
6569 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6570
6588 NATS_EXTERN natsStatus
6589js_SubscribeMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
6590 natsMsgHandler cb, void *cbClosure,
6591 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6592
6606 NATS_EXTERN natsStatus
6607js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject,
6608 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6609
6625 NATS_EXTERN natsStatus
6626js_SubscribeSyncMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
6627 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6628
6650 NATS_EXTERN natsStatus
6651js_PullSubscribe(natsSubscription **sub, jsCtx *js, const char *subject, const char *durable,
6652 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6653
6672 NATS_EXTERN natsStatus
6673natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout,
6674 jsErrCode *errCode);
6675
6682 NATS_EXTERN natsStatus
6683jsFetchRequest_Init(jsFetchRequest *request);
6684
6708 NATS_EXTERN natsStatus
6709js_PullSubscribeAsync(natsSubscription **newsub, jsCtx *js, const char *subject, const char *durable,
6710 natsMsgHandler msgCB, void *msgCBClosure,
6711 jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode);
6712
6725 NATS_EXTERN natsStatus
6726natsSubscription_FetchRequest(natsMsgList *list, natsSubscription *sub, jsFetchRequest *request);
6727
6738 NATS_EXTERN natsStatus
6739natsSubscription_GetConsumerInfo(jsConsumerInfo **ci, natsSubscription *sub,
6740 jsOptions *opts, jsErrCode *errCode);
6741
6769 NATS_EXTERN natsStatus
6770natsSubscription_GetSequenceMismatch(jsConsumerSequenceMismatch *csm, natsSubscription *sub);
6771
// end of jsSubGroup
6773
6794 NATS_EXTERN natsStatus
6795natsMsg_GetMetaData(jsMsgMetaData **new_meta, natsMsg *msg);
6796
6803 NATS_EXTERN void
6804jsMsgMetaData_Destroy(jsMsgMetaData *meta);
6805
6814 NATS_EXTERN natsStatus
6815natsMsg_Ack(natsMsg *msg, jsOptions *opts);
6816
6828 NATS_EXTERN natsStatus
6829natsMsg_AckSync(natsMsg *msg, jsOptions *opts, jsErrCode *errCode);
6830
6841 NATS_EXTERN natsStatus
6842natsMsg_Nak(natsMsg *msg, jsOptions *opts);
6843
6856 NATS_EXTERN natsStatus
6857natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts);
6858
6867 NATS_EXTERN natsStatus
6868natsMsg_InProgress(natsMsg *msg, jsOptions *opts);
6869
6878 NATS_EXTERN natsStatus
6879natsMsg_Term(natsMsg *msg, jsOptions *opts);
6880
6890 NATS_EXTERN uint64_t
6891natsMsg_GetSequence(natsMsg *msg);
6892
6902 NATS_EXTERN int64_t
6903natsMsg_GetTime(natsMsg *msg);
6904
// end of jsMsg
6906
// end of jsGroup
6908
6931 NATS_EXTERN natsStatus
6932kvConfig_Init(kvConfig *cfg);
6933
6948 NATS_EXTERN natsStatus
6949js_CreateKeyValue(kvStore **new_kv, jsCtx *js, kvConfig *cfg);
6950
6966 NATS_EXTERN natsStatus
6967js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket);
6968
6978 NATS_EXTERN natsStatus
6979js_DeleteKeyValue(jsCtx *js, const char *bucket);
6980
6988 NATS_EXTERN void
6989kvStore_Destroy(kvStore *kv);
6990
// end of kvGroupMgt
6992
7006 NATS_EXTERN const char*
7007kvEntry_Bucket(kvEntry *e);
7008
7015 NATS_EXTERN const char*
7016kvEntry_Key(kvEntry *e);
7017
7024 NATS_EXTERN const void*
7025kvEntry_Value(kvEntry *e);
7026
7033 NATS_EXTERN int
7034kvEntry_ValueLen(kvEntry *e);
7035
7043 NATS_EXTERN const char*
7044kvEntry_ValueString(kvEntry *e);
7045
7052 NATS_EXTERN uint64_t
7053kvEntry_Revision(kvEntry *e);
7054
7061 NATS_EXTERN int64_t
7062kvEntry_Created(kvEntry *e);
7063
7073 NATS_EXTERN uint64_t
7074kvEntry_Delta(kvEntry *e);
7075
7084 NATS_EXTERN kvOperation
7085kvEntry_Operation(kvEntry *e);
7086
7093 NATS_EXTERN void
7094kvEntry_Destroy(kvEntry *e);
7095
// end of kvEntry
7097
7108 NATS_EXTERN natsStatus
7109kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key);
7110
7123 NATS_EXTERN natsStatus
7124kvStore_GetRevision(kvEntry **new_entry, kvStore *kv, const char *key, uint64_t revision);
7125
7136 NATS_EXTERN natsStatus
7137kvStore_Put(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
7138
7152 NATS_EXTERN natsStatus
7153kvStore_PutString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
7154
7165 NATS_EXTERN natsStatus
7166kvStore_Create(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
7167
7181 NATS_EXTERN natsStatus
7182kvStore_CreateString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
7183
7195 NATS_EXTERN natsStatus
7196kvStore_Update(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last);
7197
7212 NATS_EXTERN natsStatus
7213kvStore_UpdateString(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last);
7214
7222 NATS_EXTERN natsStatus
7223kvStore_Delete(kvStore *kv, const char *key);
7224
7233 NATS_EXTERN natsStatus
7234kvStore_Purge(kvStore *kv, const char *key, kvPurgeOptions *opts);
7235
7243 NATS_EXTERN natsStatus
7244kvWatchOptions_Init(kvWatchOptions *opts);
7245
7253 NATS_EXTERN natsStatus
7254kvPurgeOptions_Init(kvPurgeOptions *opts);
7255
7273 NATS_EXTERN natsStatus
7274kvStore_PurgeDeletes(kvStore *kv, kvPurgeOptions *opts);
7275
7292 NATS_EXTERN natsStatus
7293kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, kvWatchOptions *opts);
7294
7316 NATS_EXTERN natsStatus
7317kvStore_WatchMulti(kvWatcher **new_watcher, kvStore *kv, const char **keys, int numKeys, kvWatchOptions *opts);
7318
7333 NATS_EXTERN natsStatus
7334kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, kvWatchOptions *opts);
7335
7354 NATS_EXTERN natsStatus
7355kvStore_Keys(kvKeysList *list, kvStore *kv, kvWatchOptions *opts);
7356
7380 NATS_EXTERN natsStatus
7381kvStore_KeysWithFilters(kvKeysList *list, kvStore *kv, const char **filters, int numFilters, kvWatchOptions *opts);
7382
7394 NATS_EXTERN void
7395kvKeysList_Destroy(kvKeysList *list);
7396
7419 NATS_EXTERN natsStatus
7420kvStore_History(kvEntryList *list, kvStore *kv, const char *key, kvWatchOptions *opts);
7421
7433 NATS_EXTERN void
7434kvEntryList_Destroy(kvEntryList *list);
7435
7445 NATS_EXTERN const char*
7446kvStore_Bucket(kvStore *kv);
7447
7448// PurgeDeletes
7449
7459 NATS_EXTERN natsStatus
7460kvStore_Status(kvStatus **new_status, kvStore *kv);
7461
7484 NATS_EXTERN natsStatus
7485kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout);
7486
7496 NATS_EXTERN natsStatus
7497kvWatcher_Stop(kvWatcher *w);
7498
7505 NATS_EXTERN void
7506kvWatcher_Destroy(kvWatcher *w);
7507
// end of kvWatcher
7509
7523 NATS_EXTERN const char*
7524kvStatus_Bucket(kvStatus *sts);
7525
7532 NATS_EXTERN uint64_t
7533kvStatus_Values(kvStatus *sts);
7534
7541 NATS_EXTERN int64_t
7542kvStatus_History(kvStatus *sts);
7543
7550 NATS_EXTERN int64_t
7551kvStatus_TTL(kvStatus *sts);
7552
7559 NATS_EXTERN int64_t
7560kvStatus_Replicas(kvStatus *sts);
7561
7568 NATS_EXTERN uint64_t
7569kvStatus_Bytes(kvStatus *sts);
7570
7577 NATS_EXTERN void
7578kvStatus_Destroy(kvStatus *sts);
7579
// end of kvStatus
7581
// end of kvGroup
7583
// end of funcGroup
7585
7586//
7587// Microservices.
7588//
7589
7632 typedef struct micro_client_s microClient;
7633
7637 typedef struct __for_forward_compatibility_only microClientConfig;
7638
7648 typedef struct micro_endpoint_s microEndpoint;
7649
7657 typedef struct micro_endpoint_config_s microEndpointConfig;
7658
7668 typedef struct micro_endpoint_info_s microEndpointInfo;
7669
7678 typedef struct micro_endpoint_stats_s microEndpointStats;
7679
7692 typedef struct micro_error_s microError;
7693
7701 typedef struct micro_group_s microGroup;
7702
7709 typedef struct micro_group_config_s microGroupConfig;
7710
7716 typedef struct micro_request_s microRequest;
7717
7729 typedef struct micro_service_s microService;
7730
7740 typedef struct micro_service_config_s microServiceConfig;
7741
7751 typedef struct micro_service_info_s microServiceInfo;
7752
7759 typedef struct micro_service_stats_s microServiceStats;
7760
7761
7762extern NATS_EXTERN microError *micro_ErrorOutOfMemory;
7763extern NATS_EXTERN microError *micro_ErrorInvalidArg;
7764
// end of microTypes
7766
7785 typedef microError *(*microRequestHandler)(microRequest *req);
7786
7809 typedef void (*microErrorHandler)(microService *m, microEndpoint *ep, natsStatus s);
7810
7822 typedef void (*microDoneHandler)(microService *m);
7823
// end of microCallbacks
7825
7836 struct micro_endpoint_config_s
7837{
7843 const char *Name;
7844
7854 const char *Subject;
7855
7860 const char *QueueGroup;
7861
7866 bool NoQueueGroup;
7867
7872 natsMetadata Metadata;
7873
7877 microRequestHandler Handler;
7878
7883 void *State;
7884};
7885
7889 struct micro_endpoint_info_s
7890{
7894 const char *Name;
7895
7899 const char *Subject;
7900
7905 const char *QueueGroup;
7906
7911 natsMetadata Metadata;
7912};
7913
7917 struct micro_endpoint_stats_s
7918{
7919 const char *Name;
7920 const char *Subject;
7921
7926 const char *QueueGroup;
7927
7931 int64_t NumRequests;
7932
7937 int64_t NumErrors;
7938
7942 int64_t ProcessingTimeSeconds;
7943
7947 int64_t ProcessingTimeNanoseconds;
7948
7952 int64_t AverageProcessingTimeNanoseconds;
7953
7957 char LastErrorString[2048];
7958};
7959
7963 struct micro_group_config_s
7964{
7966 const char *Prefix;
7967
7969 const char *QueueGroup;
7970
7972 bool NoQueueGroup;
7973};
7974
7981 struct micro_service_config_s
7982{
7988 const char *Name;
7989
7993 const char *Version;
7994
7998 const char *Description;
7999
8004 const char *QueueGroup;
8005
8010 bool NoQueueGroup;
8011
8016 natsMetadata Metadata;
8017
8025 microEndpointConfig *Endpoint;
8026
8034 microRequestHandler StatsHandler;
8035
8043 microErrorHandler ErrHandler;
8044
8053 microDoneHandler DoneHandler;
8054
8062 void *State;
8063};
8064
8070 struct micro_service_info_s
8071{
8075 const char *Type;
8076
8080 const char *Name;
8081
8085 const char *Version;
8086
8090 const char *Description;
8091
8095 const char *Id;
8096
8100 natsMetadata Metadata;
8101
8105 microEndpointInfo *Endpoints;
8106
8110 int EndpointsLen;
8111};
8112
8116 struct micro_service_stats_s
8117{
8121 const char *Type;
8122
8126 const char *Name;
8127
8131 const char *Version;
8132
8136 const char *Id;
8137
8141 int64_t Started;
8142
8146 microEndpointStats *Endpoints;
8147
8151 int EndpointsLen;
8152};
8153
// end of microStructs
8155
8167#define MICRO_API_PREFIX "$SRV"
8168
8172#define MICRO_INFO_RESPONSE_TYPE "io.nats.micro.v1.info_response"
8173
8177#define MICRO_INFO_VERB "INFO"
8178
8182#define MICRO_PING_RESPONSE_TYPE "io.nats.micro.v1.ping_response"
8183
8187#define MICRO_PING_VERB "PING"
8188
8192#define MICRO_STATS_RESPONSE_TYPE "io.nats.micro.v1.stats_response"
8193
8197#define MICRO_STATS_VERB "STATS"
8198
8203#define MICRO_STATUS_HDR "Nats-Status"
8204
8209#define MICRO_ERROR_HDR "Nats-Service-Error"
8210
8215#define MICRO_ERROR_CODE_HDR "Nats-Service-Error-Code"
8216
// end of microConstants
8218
8248 NATS_EXTERN microError *
8249micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config);
8250
8264 NATS_EXTERN microError *
8265microService_AddEndpoint(microService *m, microEndpointConfig *config);
8266
8281 NATS_EXTERN microError *
8282microService_AddGroup(microGroup **new_group, microService *m, microGroupConfig *config);
8283
8295 NATS_EXTERN microError *
8296microService_Destroy(microService *m);
8297
8306 NATS_EXTERN natsConnection *
8307microService_GetConnection(microService *m);
8308
8321 NATS_EXTERN microError *
8322microService_GetInfo(microServiceInfo **new_info, microService *m);
8323
8333 NATS_EXTERN void *
8334microService_GetState(microService *m);
8335
8348 NATS_EXTERN microError *
8349microService_GetStats(microServiceStats **new_stats, microService *m);
8350
8359 NATS_EXTERN bool
8360microService_IsStopped(microService *m);
8361
8373 NATS_EXTERN microError *
8374microService_Run(microService *m);
8375
8392 NATS_EXTERN microError *
8393microService_Stop(microService *m);
8394
// end of microServiceFunctions
8396
8417 NATS_EXTERN microError *
8418microGroup_AddGroup(microGroup **new_group, microGroup *parent, microGroupConfig *config);
8419
8433 NATS_EXTERN microError *
8434microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config);
8435
// end of microGroupFunctions
8437
8457 NATS_EXTERN microError *
8458microRequest_AddHeader(microRequest *req, const char *key, const char *value);
8459
8469 NATS_EXTERN microError *
8470microRequest_DeleteHeader(microRequest *req, const char *key);
8471
8480 NATS_EXTERN natsConnection *
8481microRequest_GetConnection(microRequest *req);
8482
8496 NATS_EXTERN const char *
8497microRequest_GetData(microRequest *req);
8498
8507 NATS_EXTERN int
8508microRequest_GetDataLength(microRequest *req);
8509
8519 NATS_EXTERN void *
8520microRequest_GetEndpointState(microRequest *req);
8521
8538 NATS_EXTERN microError *
8539microRequest_GetHeaderKeys(microRequest *req, const char ***keys, int *count);
8540
8552 NATS_EXTERN microError *
8553microRequest_GetHeaderValue(microRequest *req, const char *key, const char **value);
8554
8570 NATS_EXTERN microError *
8571microRequest_GetHeaderValues(microRequest *req, const char *key, const char ***values, int *count);
8572
8579 NATS_EXTERN natsMsg *
8580microRequest_GetMsg(microRequest *req);
8581
8591 NATS_EXTERN const char *
8592microRequest_GetReply(microRequest *req);
8593
8600 NATS_EXTERN microService *
8601microRequest_GetService(microRequest *req);
8602
8611 NATS_EXTERN void *
8612microRequest_GetServiceState(microRequest *req);
8613
8621 NATS_EXTERN const char *
8622microRequest_GetSubject(microRequest *req);
8623
8633 NATS_EXTERN microError *
8634microRequest_Respond(microRequest *req, const char *data, size_t len);
8635
8650 NATS_EXTERN microError *
8651microRequest_RespondError(microRequest *req, microError *err);
8652
8696 NATS_EXTERN microError *
8697microRequest_RespondCustom(microRequest *req, microError *err, const char *data, size_t len);
8698
8712 NATS_EXTERN microError *
8713microRequest_SetHeader(microRequest *req, const char *key, const char *value);
8714
// end of microRequestFunctions
8716
8732 NATS_EXTERN microError *
8733micro_Errorf(const char *format, ...);
8734
8746 NATS_EXTERN microError *
8747micro_ErrorfCode(int code, const char *format, ...);
8748
8755 NATS_EXTERN microError *
8756micro_ErrorFromStatus(natsStatus s);
8757
8764 NATS_EXTERN int
8765microError_Code(microError *err);
8766
8771 NATS_EXTERN void
8772microError_Destroy(microError *err);
8773
8774#define microError_Ignore(__err) microError_Destroy(__err)
8775
8783 NATS_EXTERN natsStatus
8784microError_Status(microError *err);
8785
8797 NATS_EXTERN const char *
8798microError_String(microError *err, char *buf, size_t len);
8799
8813 NATS_EXTERN microError *
8814microError_Wrapf(microError *err, const char *format, ...);
8815
// end of microErrorFunctions
8817
8832 NATS_EXTERN microError *
8833micro_NewClient(microClient **new_client, natsConnection *nc, microClientConfig *cfg);
8834
8840 NATS_EXTERN void
8841microClient_Destroy(microClient *client);
8842
8855 NATS_EXTERN microError *
8856microClient_DoRequest(natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len);
8857
// end of microClientFunctions
8859
8871 NATS_EXTERN void
8872microServiceInfo_Destroy(microServiceInfo *info);
8873
8879 NATS_EXTERN void
8880microServiceStats_Destroy(microServiceStats *stats);
8881
// end of microCleanupFunctions
8883
// end of microFunctions
8885
// end of microGroup
8887
8924#ifdef __cplusplus
8925}
8926#endif
8927
8928#endif /* NATS_H_ */
natsOnCompleteCB
void(* natsOnCompleteCB)(void *closure)
Callback used to notify that an object lifecycle is complete.
Definition nats.h:1747
natsEvLoop_Attach
natsStatus(* natsEvLoop_Attach)(void **userData, void *loop, natsConnection *nc, natsSock socket)
Attach this connection to the external event loop.
Definition nats.h:1628
natsUserJWTHandler
natsStatus(* natsUserJWTHandler)(char **userJWT, char **customErrTxt, void *closure)
Callback used to fetch and return account signed user JWT.
Definition nats.h:1691
natsEvLoop_WriteAddRemove
natsStatus(* natsEvLoop_WriteAddRemove)(void *userData, bool add)
Write event needs to be added or removed.
Definition nats.h:1656
natsCustomReconnectDelayHandler
int64_t(* natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure)
Callback used to specify how long to wait between reconnects.
Definition nats.h:1769
natsTokenHandler
const char *(* natsTokenHandler)(void *closure)
Callback used to build a token on connections and reconnections.
Definition nats.h:1737
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:1848
jsPubAckErrHandler
void(* jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish errors from JetStream.
Definition nats.h:1805
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:1611
natsEvLoop_Detach
natsStatus(* natsEvLoop_Detach)(void *userData)
Detach from the event loop.
Definition nats.h:1667
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:1722
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:1880
natsConnectionHandler
void(* natsConnectionHandler)(natsConnection *nc, void *closure)
Callback used to notify the user of asynchronous connection events.
Definition nats.h:1602
natsMsgHandler
void(* natsMsgHandler)(natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition nats.h:1586
stanPubAckHandler
void(* stanPubAckHandler)(const char *guid, const char *error, void *closure)
Callback used to notify of an asynchronous publish result.
Definition nats.h:1860
natsEvLoop_ReadAddRemove
natsStatus(* natsEvLoop_ReadAddRemove)(void *userData, bool add)
Read event needs to be added or removed.
Definition nats.h:1643
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:1871
natsConnection_Buffered
NATS_EXTERN int natsConnection_Buffered(natsConnection *nc)
Returns the number of bytes to be sent to the server.
natsConnection_ReadLastError
NATS_EXTERN natsStatus natsConnection_ReadLastError(natsConnection *nc, char *buf, size_t n)
Read the last connection error into a user provided buffer.
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_IsDraining
NATS_EXTERN bool natsConnection_IsDraining(natsConnection *nc)
Test if connection is draining.
natsConnection_Reconnect
NATS_EXTERN natsStatus natsConnection_Reconnect(natsConnection *nc)
Drops the current connection, reconnects including re-subscribing.
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_FlushTimeout
NATS_EXTERN natsStatus natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout)
Flushes the connection with a given timeout.
natsConnection_ProcessCloseEvent
NATS_EXTERN void natsConnection_ProcessCloseEvent(natsSock *socket)
Process a socket close event when using external event loop.
natsConnection_GetLocalIPAndPort
NATS_EXTERN natsStatus natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port)
Returns the connection local IP and port.
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.
jsConsumerPauseResponse_Destroy
NATS_EXTERN void jsConsumerPauseResponse_Destroy(jsConsumerPauseResponse *cpr)
Destroys the PauseConsumer response object.
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.
js_PauseConsumer
NATS_EXTERN natsStatus js_PauseConsumer(jsConsumerPauseResponse **new_cpr, jsCtx *js, const char *stream, const char *consumer, uint64_t pauseUntil, jsOptions *opts, jsErrCode *errCode)
Pauses a consumer.
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_PullSubscribeAsync
NATS_EXTERN natsStatus js_PullSubscribeAsync(natsSubscription **newsub, jsCtx *js, const char *subject, const char *durable, natsMsgHandler msgCB, void *msgCBClosure, jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode)
Starts a Pull based JetStream subscription, and delivers messages to a user callback asynchronously.
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.
js_SubscribeSyncMulti
NATS_EXTERN natsStatus js_SubscribeSyncMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create an asynchronous subscription to multiple subjects.
js_SubscribeMulti
NATS_EXTERN natsStatus js_SubscribeMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects, natsMsgHandler cb, void *cbClosure, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create an asynchronous subscription to multiple subjects.
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_WatchMulti
NATS_EXTERN natsStatus kvStore_WatchMulti(kvWatcher **new_watcher, kvStore *kv, const char **keys, int numKeys, kvWatchOptions *opts)
Returns a watcher for any updates to keys that match one of the keys argument.
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.
kvStore_KeysWithFilters
NATS_EXTERN natsStatus kvStore_KeysWithFilters(kvKeysList *list, kvStore *kv, const char **filters, int numFilters, kvWatchOptions *opts)
Returns all keys in the bucket which matches the list of subject like filters.
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_OpenWithConfig
NATS_EXTERN natsStatus nats_OpenWithConfig(natsClientConfig *config)
Initializes the library.
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:7809
microRequestHandler
microError *(* microRequestHandler)(microRequest *req)
Callback type for request processing.
Definition nats.h:7785
microDoneHandler
void(* microDoneHandler)(microService *m)
Callback type for Done (service stopped) notifications.
Definition nats.h:7822
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_AddEndpoint
NATS_EXTERN microError * microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config)
Adds an endpoint to a microGroup and starts listening for messages.
microGroup_AddGroup
NATS_EXTERN microError * microGroup_AddGroup(microGroup **new_group, microGroup *parent, microGroupConfig *config)
Adds a sub-group to microGroup.
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,...
microService_AddGroup
NATS_EXTERN microError * microService_AddGroup(microGroup **new_group, microService *m, microGroupConfig *config)
Adds an group (prefix) to a microservice.
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_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:7632
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:7701
microRequest
struct micro_request_s microRequest
a request received by a microservice endpoint.
Definition nats.h:7716
microError
struct micro_error_s microError
the Microservice error object.
Definition nats.h:7692
microClientConfig
struct __for_forward_compatibility_only microClientConfig
The Microservice configuration object. For forward compatibility only.
Definition nats.h:7637
micro_ErrorInvalidArg
NATS_EXTERN microError * micro_ErrorInvalidArg
micro_ErrorOutOfMemory
NATS_EXTERN microError * micro_ErrorOutOfMemory
microEndpoint
struct micro_endpoint_s microEndpoint
microEndpoint represents a microservice endpoint.
Definition nats.h:7648
microService
struct micro_service_s microService
the main object for a configured microservice.
Definition nats.h:7729
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_SetMaxPendingBytes
NATS_EXTERN natsStatus natsOptions_SetMaxPendingBytes(natsOptions *opts, int64_t maxPending)
Sets the maximum number of pending bytes per subscription.
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_SetSSLVerificationCallback
NATS_EXTERN natsStatus natsOptions_SetSSLVerificationCallback(natsOptions *opts, SSL_verify_cb callback)
Sets the certificate validation callback.
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_TLSHandshakeFirst
NATS_EXTERN natsStatus natsOptions_TLSHandshakeFirst(natsOptions *opts)
Performs TLS handshake first.
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:1555
kvStore
struct __kvStore kvStore
Definition nats.h:1390
jsStorageCompression
jsStorageCompression
Definition nats.h:334
jsDeliverPolicy
jsDeliverPolicy
Definition nats.h:343
stanConnOptions
struct __stanConnOptions stanConnOptions
Way to configure a stanConnection.
Definition nats.h:1549
jsStorageType
jsStorageType
Definition nats.h:324
natsInbox
char natsInbox
Unique subject often used for point-to-point communication.
Definition nats.h:195
stanMsg
struct __stanMsg stanMsg
The Streaming message.
Definition nats.h:1543
jsRetentionPolicy
jsRetentionPolicy
Definition nats.h:303
kvWatcher
struct __kvWatcher kvWatcher
Definition nats.h:1405
natsStatistics
struct __natsStatistics natsStatistics
Statistics of a natsConnection.
Definition nats.h:167
jsFetchNextHandler
bool(* jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure)
Callback used to customize flow control for js_PullSubscribeAsync.
Definition nats.h:1248
jsDiscardPolicy
jsDiscardPolicy
Definition nats.h:314
jsReplayPolicy
jsReplayPolicy
Definition nats.h:369
natsSubscription
struct __natsSubscription natsSubscription
Interest on a given subject.
Definition nats.h:173
kvOperation
kvOperation
Definition nats.h:1411
jsAckPolicy
jsAckPolicy
Definition nats.h:357
stanConnection
struct __stanConnection stanConnection
A connection to a NATS Streaming Server.
Definition nats.h:1531
jsFetchCompleteHandler
void(* jsFetchCompleteHandler)(natsConnection *nc, natsSubscription *sub, natsStatus s, void *closure)
Callback used to indicate that the work of js_PullSubscribeAsync is done.
Definition nats.h:1236
jsCtx
struct __jsCtx jsCtx
Definition nats.h:270
natsOptions
struct __natsOptions natsOptions
Way to configure a natsConnection.
Definition nats.h:186
natsClientConfig
struct __natsClientConfig natsClientConfig
An initial configuration for NATS client. Provides control over the threading model,...
kvStatus
struct __kvStatus kvStatus
Definition nats.h:1400
kvEntry
struct __kvEntry kvEntry
Definition nats.h:1395
natsMsg
struct __natsMsg natsMsg
A structure holding a subject, optional reply and payload.
Definition nats.h:180
stanSubscription
struct __stanSubscription stanSubscription
Interest on a given channel.
Definition nats.h:1537
natsConnection
struct __natsConnection natsConnection
A connection to a NATS Server.
Definition nats.h:160
js_StorageCompressionNone
@ js_StorageCompressionNone
Specifies no compression. It's the default.
Definition nats.h:335
js_StorageCompressionS2
@ js_StorageCompressionS2
Specifies S2.
Definition nats.h:336
js_DeliverByStartSequence
@ js_DeliverByStartSequence
Starts from a given sequence.
Definition nats.h:347
js_DeliverByStartTime
@ js_DeliverByStartTime
Starts from a given UTC time (number of nanoseconds since epoch)
Definition nats.h:348
js_DeliverNew
@ js_DeliverNew
Starts with messages sent after the consumer is created.
Definition nats.h:346
js_DeliverLastPerSubject
@ js_DeliverLastPerSubject
Starts with the last message for all subjects received.
Definition nats.h:349
js_DeliverLast
@ js_DeliverLast
Starts with the last sequence received.
Definition nats.h:345
js_DeliverAll
@ js_DeliverAll
Starts from the very beginning of a stream. This is the default.
Definition nats.h:344
js_FileStorage
@ js_FileStorage
Specifies on disk storage. It's the default.
Definition nats.h:325
js_MemoryStorage
@ js_MemoryStorage
Specifies in memory only.
Definition nats.h:326
js_LimitsPolicy
@ js_LimitsPolicy
Specifies that messages are retained until any given limit is reached, which could be one of MaxMsgs,...
Definition nats.h:304
js_InterestPolicy
@ js_InterestPolicy
Specifies that when all known observables have acknowledged a message it can be removed.
Definition nats.h:305
js_WorkQueuePolicy
@ js_WorkQueuePolicy
Specifies that when the first worker or subscriber acknowledges the message it can be removed.
Definition nats.h:306
js_DiscardNew
@ js_DiscardNew
Will fail to store new messages.
Definition nats.h:316
js_DiscardOld
@ js_DiscardOld
Will remove older messages to return to the limits. This is the default.
Definition nats.h:315
js_ReplayInstant
@ js_ReplayInstant
Replays messages as fast as possible.
Definition nats.h:370
js_ReplayOriginal
@ js_ReplayOriginal
Maintains the same timing as the messages were received.
Definition nats.h:371
kvOp_Unknown
@ kvOp_Unknown
Definition nats.h:1412
kvOp_Delete
@ kvOp_Delete
Definition nats.h:1414
kvOp_Put
@ kvOp_Put
Definition nats.h:1413
kvOp_Purge
@ kvOp_Purge
Definition nats.h:1415
js_AckExplicit
@ js_AckExplicit
Requires ack or nack for all messages.
Definition nats.h:358
js_AckAll
@ js_AckAll
When acking a sequence number, this implicitly acks all sequences below this one as well.
Definition nats.h:360
js_AckNone
@ js_AckNone
Requires no acks for delivered messages.
Definition nats.h:359
NATS_EXTERN
#define NATS_EXTERN
Needed for shared library.
Definition nats.h:57
natsSock
int natsSock
Definition nats.h:58
status.h
jsErrCode
jsErrCode
Definition status.h:138
natsStatus
natsStatus
Status returned by most of the APIs.
Definition status.h:50
natsConnStatus
natsConnStatus
The connection state.
Definition status.h:24
__natsClientConfig
An initial configuration for NATS client. Provides control over the threading model,...
Definition nats.h:204
__natsClientConfig::DefaultRepliesToThreadPool
bool DefaultRepliesToThreadPool
Definition nats.h:214
__natsClientConfig::UseSeparatePoolForReplies
bool UseSeparatePoolForReplies
Definition nats.h:215
__natsClientConfig::ReplyThreadPoolMax
int ReplyThreadPoolMax
Definition nats.h:216
__natsClientConfig::ThreadPoolMax
int ThreadPoolMax
Definition nats.h:211
__natsClientConfig::DefaultWriteDeadline
int64_t DefaultWriteDeadline
Definition nats.h:205
__natsClientConfig::DefaultToThreadPool
bool DefaultToThreadPool
Definition nats.h:210
__natsClientConfig::LockSpinCount
int64_t LockSpinCount
Definition nats.h:207
jsAPIStats
Definition nats.h:1083
jsAPIStats::Total
uint64_t Total
Definition nats.h:1084
jsAPIStats::Errors
uint64_t Errors
Definition nats.h:1085
jsAccountInfo
Definition nats.h:1120
jsAccountInfo::Consumers
int64_t Consumers
Definition nats.h:1124
jsAccountInfo::Streams
int64_t Streams
Definition nats.h:1123
jsAccountInfo::TiersLen
int TiersLen
Definition nats.h:1129
jsAccountInfo::Memory
uint64_t Memory
Definition nats.h:1121
jsAccountInfo::API
jsAPIStats API
Definition nats.h:1126
jsAccountInfo::Limits
jsAccountLimits Limits
Definition nats.h:1127
jsAccountInfo::Tiers
jsTier ** Tiers
Definition nats.h:1128
jsAccountInfo::Domain
char * Domain
Definition nats.h:1125
jsAccountInfo::Store
uint64_t Store
Definition nats.h:1122
jsAccountLimits
Definition nats.h:1093
jsAccountLimits::MemoryMaxStreamBytes
int64_t MemoryMaxStreamBytes
Definition nats.h:1099
jsAccountLimits::MaxStreams
int64_t MaxStreams
Definition nats.h:1096
jsAccountLimits::MaxAckPending
int64_t MaxAckPending
Definition nats.h:1098
jsAccountLimits::MaxConsumers
int64_t MaxConsumers
Definition nats.h:1097
jsAccountLimits::MaxStore
int64_t MaxStore
Definition nats.h:1095
jsAccountLimits::MaxMemory
int64_t MaxMemory
Definition nats.h:1094
jsAccountLimits::MaxBytesRequired
bool MaxBytesRequired
Definition nats.h:1101
jsAccountLimits::StoreMaxStreamBytes
int64_t StoreMaxStreamBytes
Definition nats.h:1100
jsClusterInfo
Definition nats.h:716
jsClusterInfo::ReplicasLen
int ReplicasLen
Definition nats.h:720
jsClusterInfo::Name
char * Name
Definition nats.h:717
jsClusterInfo::Replicas
jsPeerInfo ** Replicas
Definition nats.h:719
jsClusterInfo::Leader
char * Leader
Definition nats.h:718
jsConsumerConfig
Definition nats.h:842
jsConsumerConfig::MemoryStorage
bool MemoryStorage
Definition nats.h:879
jsConsumerConfig::Name
const char * Name
Definition nats.h:843
jsConsumerConfig::FilterSubjectsLen
int FilterSubjectsLen
Definition nats.h:884
jsConsumerConfig::OptStartSeq
uint64_t OptStartSeq
Definition nats.h:847
jsConsumerConfig::HeadersOnly
bool HeadersOnly
Definition nats.h:862
jsConsumerConfig::RateLimit
uint64_t RateLimit
Definition nats.h:856
jsConsumerConfig::DeliverPolicy
jsDeliverPolicy DeliverPolicy
Definition nats.h:846
jsConsumerConfig::Description
const char * Description
Definition nats.h:845
jsConsumerConfig::Durable
const char * Durable
Definition nats.h:844
jsConsumerConfig::SampleFrequency
const char * SampleFrequency
Definition nats.h:857
jsConsumerConfig::FlowControl
bool FlowControl
Definition nats.h:860
jsConsumerConfig::MaxRequestBatch
int64_t MaxRequestBatch
Maximum Pull Consumer request batch size.
Definition nats.h:865
jsConsumerConfig::AckWait
int64_t AckWait
Definition nats.h:850
jsConsumerConfig::MaxRequestMaxBytes
int64_t MaxRequestMaxBytes
Maximum Pull Consumer request maximum bytes.
Definition nats.h:867
jsConsumerConfig::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:848
jsConsumerConfig::MaxWaiting
int64_t MaxWaiting
Definition nats.h:858
jsConsumerConfig::AckPolicy
jsAckPolicy AckPolicy
Definition nats.h:849
jsConsumerConfig::Metadata
natsMetadata Metadata
User-provided metadata for the consumer, encoded as an array of {"key", "value",.....
Definition nats.h:885
jsConsumerConfig::DeliverSubject
const char * DeliverSubject
Definition nats.h:870
jsConsumerConfig::BackOff
int64_t * BackOff
Redelivery durations expressed in nanoseconds.
Definition nats.h:852
jsConsumerConfig::MaxRequestExpires
int64_t MaxRequestExpires
Maximum Pull Consumer request expiration, expressed in number of nanoseconds.
Definition nats.h:866
jsConsumerConfig::Heartbeat
int64_t Heartbeat
Heartbeat interval expressed in number of nanoseconds.
Definition nats.h:861
jsConsumerConfig::PauseUntil
int64_t PauseUntil
Suspends the consumer until this deadline, represented as number of nanoseconds since epoch.
Definition nats.h:889
jsConsumerConfig::Replicas
int64_t Replicas
Definition nats.h:877
jsConsumerConfig::BackOffLen
int BackOffLen
Definition nats.h:853
jsConsumerConfig::MaxDeliver
int64_t MaxDeliver
Definition nats.h:851
jsConsumerConfig::FilterSubjects
const char ** FilterSubjects
Multiple filter subjects.
Definition nats.h:883
jsConsumerConfig::ReplayPolicy
jsReplayPolicy ReplayPolicy
Definition nats.h:855
jsConsumerConfig::DeliverGroup
const char * DeliverGroup
Definition nats.h:871
jsConsumerConfig::MaxAckPending
int64_t MaxAckPending
Definition nats.h:859
jsConsumerConfig::FilterSubject
const char * FilterSubject
Definition nats.h:854
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:874
jsConsumerInfo
Definition nats.h:1022
jsConsumerInfo::Paused
bool Paused
Definition nats.h:1035
jsConsumerInfo::Delivered
jsSequenceInfo Delivered
Definition nats.h:1027
jsConsumerInfo::Config
jsConsumerConfig * Config
Definition nats.h:1026
jsConsumerInfo::PushBound
bool PushBound
Definition nats.h:1034
jsConsumerInfo::NumWaiting
int64_t NumWaiting
Definition nats.h:1031
jsConsumerInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1025
jsConsumerInfo::Cluster
jsClusterInfo * Cluster
Definition nats.h:1033
jsConsumerInfo::PauseRemaining
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition nats.h:1036
jsConsumerInfo::NumAckPending
int64_t NumAckPending
Definition nats.h:1029
jsConsumerInfo::Stream
char * Stream
Definition nats.h:1023
jsConsumerInfo::NumRedelivered
int64_t NumRedelivered
Definition nats.h:1030
jsConsumerInfo::Name
char * Name
Definition nats.h:1024
jsConsumerInfo::AckFloor
jsSequenceInfo AckFloor
Definition nats.h:1028
jsConsumerInfo::NumPending
uint64_t NumPending
Definition nats.h:1032
jsConsumerInfoList
Definition nats.h:1047
jsConsumerInfoList::List
jsConsumerInfo ** List
Definition nats.h:1048
jsConsumerInfoList::Count
int Count
Definition nats.h:1049
jsConsumerNamesList
Definition nats.h:1061
jsConsumerNamesList::Count
int Count
Definition nats.h:1063
jsConsumerNamesList::List
char ** List
Definition nats.h:1062
jsConsumerPauseResponse
Definition nats.h:1073
jsConsumerPauseResponse::PauseRemaining
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition nats.h:1076
jsConsumerPauseResponse::Paused
bool Paused
Definition nats.h:1074
jsConsumerPauseResponse::PauseUntil
int64_t PauseUntil
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1075
jsConsumerSequenceMismatch
Definition nats.h:910
jsConsumerSequenceMismatch::Stream
uint64_t Stream
This is the stream sequence that the application should resume from.
Definition nats.h:911
jsConsumerSequenceMismatch::ConsumerServer
uint64_t ConsumerServer
This is the consumer sequence last sent by the server.
Definition nats.h:913
jsConsumerSequenceMismatch::ConsumerClient
uint64_t ConsumerClient
This is the consumer sequence that was last received by the library.
Definition nats.h:912
jsDirectGetMsgOptions
Definition nats.h:1193
jsDirectGetMsgOptions::NextBySubject
const char * NextBySubject
Get the next message (based on sequence) for that subject.
Definition nats.h:1195
jsDirectGetMsgOptions::Sequence
uint64_t Sequence
Get the message at this sequence.
Definition nats.h:1194
jsDirectGetMsgOptions::LastBySubject
const char * LastBySubject
Get the last message on that subject.
Definition nats.h:1196
jsExternalStream
Definition nats.h:405
jsExternalStream::DeliverPrefix
const char * DeliverPrefix
Definition nats.h:407
jsExternalStream::APIPrefix
const char * APIPrefix
Definition nats.h:406
jsFetchRequest
Definition nats.h:1206
jsFetchRequest::MaxBytes
int64_t MaxBytes
Maximum bytes for the request (request complete based on whichever Batch or MaxBytes comes first)
Definition nats.h:1209
jsFetchRequest::Batch
int Batch
Maximum number of messages to be received (see MaxBytes)
Definition nats.h:1208
jsFetchRequest::Expires
int64_t Expires
Expiration of the request, expressed in nanoseconds.
Definition nats.h:1207
jsFetchRequest::NoWait
bool NoWait
Will not wait if the request cannot be completed.
Definition nats.h:1210
jsFetchRequest::Heartbeat
int64_t Heartbeat
Have server sends heartbeats to help detect communication failures.
Definition nats.h:1211
jsLostStreamData
Definition nats.h:618
jsLostStreamData::Msgs
uint64_t * Msgs
Definition nats.h:619
jsLostStreamData::Bytes
uint64_t Bytes
Definition nats.h:621
jsLostStreamData::MsgsLen
int MsgsLen
Definition nats.h:620
jsMsgMetaData
Definition nats.h:1141
jsMsgMetaData::NumPending
uint64_t NumPending
Definition nats.h:1144
jsMsgMetaData::Sequence
jsSequencePair Sequence
Definition nats.h:1142
jsMsgMetaData::Stream
char * Stream
Definition nats.h:1146
jsMsgMetaData::Domain
char * Domain
Definition nats.h:1148
jsMsgMetaData::Consumer
char * Consumer
Definition nats.h:1147
jsMsgMetaData::NumDelivered
uint64_t NumDelivered
Definition nats.h:1143
jsMsgMetaData::Timestamp
int64_t Timestamp
Definition nats.h:1145
jsOptions
Definition nats.h:1377
jsOptions::PullSubscribeAsync
jsOptionsPullSubscribeAsync PullSubscribeAsync
extra options for js_PullSubscribeAsync
Definition nats.h:1382
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:1380
jsOptions::PublishAsync
jsOptionsPublishAsync PublishAsync
extra options for js_PublishAsync
Definition nats.h:1381
jsOptions::Prefix
const char * Prefix
JetStream prefix, default is "$JS.API".
Definition nats.h:1378
jsOptions::Stream
jsOptionsStream Stream
Optional stream options.
Definition nats.h:1383
jsOptions::Domain
const char * Domain
Domain changes the domain part of JetSteam API prefix.
Definition nats.h:1379
jsOptionsPublishAsync
Definition nats.h:1309
jsOptionsPublishAsync::MaxPending
int64_t MaxPending
Maximum outstanding asynchronous publishes that can be inflight at one time.
Definition nats.h:1310
jsOptionsPublishAsync::AckHandlerClosure
void * AckHandlerClosure
Closure (or user data) passed to jsPubAckHandler callback.
Definition nats.h:1318
jsOptionsPublishAsync::AckHandler
jsPubAckHandler AckHandler
Callback invoked for each asynchronous published message.
Definition nats.h:1317
jsOptionsPublishAsync::ErrHandler
jsPubAckErrHandler ErrHandler
Callback invoked when error encountered publishing a given message.
Definition nats.h:1324
jsOptionsPublishAsync::ErrHandlerClosure
void * ErrHandlerClosure
Closure (or user data) passed to jsPubAckErrHandler callback.
Definition nats.h:1325
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:1327
jsOptionsPullSubscribeAsync
Definition nats.h:1256
jsOptionsPullSubscribeAsync::MaxBytes
int64_t MaxBytes
Auto-unsubscribe after receiving this many bytes.
Definition nats.h:1259
jsOptionsPullSubscribeAsync::FetchSize
int FetchSize
When using the automatic Fetch flow control (default NextHandler), this is the number of messages to ...
Definition nats.h:1283
jsOptionsPullSubscribeAsync::NextHandlerClosure
void * NextHandlerClosure
Definition nats.h:1299
jsOptionsPullSubscribeAsync::MaxMessages
int MaxMessages
Auto-unsubscribed after receiving this many messages.
Definition nats.h:1258
jsOptionsPullSubscribeAsync::Timeout
int64_t Timeout
Auto-unsubsribe after this many milliseconds.
Definition nats.h:1257
jsOptionsPullSubscribeAsync::NextHandler
jsFetchNextHandler NextHandler
If set, switches to manual fetch flow control.
Definition nats.h:1298
jsOptionsPullSubscribeAsync::CompleteHandler
jsFetchCompleteHandler CompleteHandler
Fetch complete handler that receives the exit status code, the subscription's Complete handler is als...
Definition nats.h:1273
jsOptionsPullSubscribeAsync::Heartbeat
int64_t Heartbeat
Have server sends heartbeats at this interval (in milliseconds) to help detect communication failures...
Definition nats.h:1278
jsOptionsPullSubscribeAsync::NoWait
bool NoWait
If NoWait is set, the subscription will receive the messages already stored on the server subject to ...
Definition nats.h:1268
jsOptionsPullSubscribeAsync::CompleteHandlerClosure
void * CompleteHandlerClosure
Definition nats.h:1274
jsOptionsPullSubscribeAsync::KeepAhead
int KeepAhead
When using the automatic Fetch flow control (default NextHandler), initiate the next fetch request (t...
Definition nats.h:1291
jsOptionsStream
Definition nats.h:1365
jsOptionsStream::Info
jsOptionsStreamInfo Info
Optional stream information retrieval options.
Definition nats.h:1367
jsOptionsStream::Purge
jsOptionsStreamPurge Purge
Optional stream purge options.
Definition nats.h:1366
jsOptionsStreamInfo
Definition nats.h:1352
jsOptionsStreamInfo::DeletedDetails
bool DeletedDetails
Get the list of deleted message sequences.
Definition nats.h:1353
jsOptionsStreamInfo::SubjectsFilter
const char * SubjectsFilter
Get the list of subjects in this stream.
Definition nats.h:1354
jsOptionsStreamPurge
Definition nats.h:1341
jsOptionsStreamPurge::Keep
uint64_t Keep
Number of messages to keep.
Definition nats.h:1344
jsOptionsStreamPurge::Subject
const char * Subject
This is the subject to match against messages for the purge command.
Definition nats.h:1342
jsOptionsStreamPurge::Sequence
uint64_t Sequence
Purge up to but not including sequence.
Definition nats.h:1343
jsPeerInfo
Definition nats.h:702
jsPeerInfo::Offline
bool Offline
Definition nats.h:705
jsPeerInfo::Lag
uint64_t Lag
Definition nats.h:707
jsPeerInfo::Active
int64_t Active
Definition nats.h:706
jsPeerInfo::Name
char * Name
Definition nats.h:703
jsPeerInfo::Current
bool Current
Definition nats.h:704
jsPlacement
Definition nats.h:388
jsPlacement::TagsLen
int TagsLen
Definition nats.h:391
jsPlacement::Cluster
const char * Cluster
Definition nats.h:389
jsPlacement::Tags
const char ** Tags
Definition nats.h:390
jsPubAckErr
Definition nats.h:1169
jsPubAckErr::Msg
natsMsg * Msg
Definition nats.h:1170
jsPubAckErr::Err
natsStatus Err
Definition nats.h:1171
jsPubAckErr::ErrCode
jsErrCode ErrCode
Definition nats.h:1172
jsPubAckErr::ErrText
const char * ErrText
Definition nats.h:1173
jsPubAck
Definition nats.h:1156
jsPubAck::Sequence
uint64_t Sequence
Definition nats.h:1158
jsPubAck::Duplicate
bool Duplicate
Definition nats.h:1160
jsPubAck::Domain
char * Domain
Definition nats.h:1159
jsPubAck::Stream
char * Stream
Definition nats.h:1157
jsPubOptions
Definition nats.h:288
jsPubOptions::ExpectLastMsgId
const char * ExpectLastMsgId
Expected last message ID in the stream.
Definition nats.h:292
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:289
jsPubOptions::ExpectLastSeq
uint64_t ExpectLastSeq
Expected last message sequence in the stream.
Definition nats.h:293
jsPubOptions::ExpectNoMessage
bool ExpectNoMessage
Expected no message (that is, sequence == 0) for the subject in the stream.
Definition nats.h:295
jsPubOptions::ExpectStream
const char * ExpectStream
Expected stream to respond from the publish call.
Definition nats.h:291
jsPubOptions::MsgId
const char * MsgId
Message ID used for de-duplication.
Definition nats.h:290
jsPubOptions::ExpectLastSubjectSeq
uint64_t ExpectLastSubjectSeq
Expected last message sequence for the subject in the stream.
Definition nats.h:294
jsRePublish
Definition nats.h:441
jsRePublish::HeadersOnly
bool HeadersOnly
Definition nats.h:444
jsRePublish::Source
const char * Source
Definition nats.h:442
jsRePublish::Destination
const char * Destination
Definition nats.h:443
jsSequenceInfo
Definition nats.h:1008
jsSequenceInfo::Last
int64_t Last
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1011
jsSequenceInfo::Stream
uint64_t Stream
Definition nats.h:1010
jsSequenceInfo::Consumer
uint64_t Consumer
Definition nats.h:1009
jsSequencePair
Definition nats.h:998
jsSequencePair::Consumer
uint64_t Consumer
Definition nats.h:999
jsSequencePair::Stream
uint64_t Stream
Definition nats.h:1000
jsStreamAlternate
Definition nats.h:743
jsStreamAlternate::Name
const char * Name
Definition nats.h:744
jsStreamAlternate::Cluster
const char * Cluster
Definition nats.h:746
jsStreamAlternate::Domain
const char * Domain
Definition nats.h:745
jsStreamConfig
Definition nats.h:547
jsStreamConfig::Discard
jsDiscardPolicy Discard
Definition nats.h:559
jsStreamConfig::Subjects
const char ** Subjects
Definition nats.h:550
jsStreamConfig::SubjectTransform
jsSubjectTransformConfig SubjectTransform
Applies a subject transform (to matching messages) before doing anything else when a new message is r...
Definition nats.h:607
jsStreamConfig::AllowDirect
bool AllowDirect
Allow higher performance, direct access to get individual messages. E.g. KeyValue.
Definition nats.h:583
jsStreamConfig::SourcesLen
int SourcesLen
Definition nats.h:568
jsStreamConfig::DiscardNewPerSubject
bool DiscardNewPerSubject
Allow KV like semantics to also discard new on a per subject basis.
Definition nats.h:591
jsStreamConfig::Compression
jsStorageCompression Compression
js_StorageCompressionNone (default) or js_StorageCompressionS2.
Definition nats.h:600
jsStreamConfig::Description
const char * Description
Definition nats.h:549
jsStreamConfig::Template
const char * Template
Definition nats.h:563
jsStreamConfig::DenyPurge
bool DenyPurge
Restrict the ability to purge messages.
Definition nats.h:571
jsStreamConfig::Storage
jsStorageType Storage
Definition nats.h:560
jsStreamConfig::ConsumerLimits
jsStreamConsumerLimits ConsumerLimits
Sets the limits on certain options on all consumers of the stream.
Definition nats.h:611
jsStreamConfig::Retention
jsRetentionPolicy Retention
Definition nats.h:552
jsStreamConfig::MaxMsgs
int64_t MaxMsgs
Definition nats.h:554
jsStreamConfig::MaxConsumers
int64_t MaxConsumers
Definition nats.h:553
jsStreamConfig::Metadata
natsMetadata Metadata
A user-provided array of key/value pairs, encoded as a string array [n1, v1, n2, v2,...
Definition nats.h:596
jsStreamConfig::FirstSeq
uint64_t FirstSeq
the starting sequence number for the stream.
Definition nats.h:603
jsStreamConfig::Name
const char * Name
Definition nats.h:548
jsStreamConfig::NoAck
bool NoAck
Definition nats.h:562
jsStreamConfig::Sources
jsStreamSource ** Sources
Definition nats.h:567
jsStreamConfig::MaxMsgSize
int32_t MaxMsgSize
Definition nats.h:558
jsStreamConfig::RePublish
jsRePublish * RePublish
Allow republish of the message after being sequenced and stored.
Definition nats.h:579
jsStreamConfig::MirrorDirect
bool MirrorDirect
Allow higher performance and unified direct access for mirrors as well.
Definition nats.h:587
jsStreamConfig::Duplicates
int64_t Duplicates
Definition nats.h:564
jsStreamConfig::MaxMsgsPerSubject
int64_t MaxMsgsPerSubject
Definition nats.h:557
jsStreamConfig::MaxAge
int64_t MaxAge
Definition nats.h:556
jsStreamConfig::SubjectsLen
int SubjectsLen
Definition nats.h:551
jsStreamConfig::AllowRollup
bool AllowRollup
Allow messages to be placed into the system and purge all older messages using a special message head...
Definition nats.h:575
jsStreamConfig::Mirror
jsStreamSource * Mirror
Definition nats.h:566
jsStreamConfig::Placement
jsPlacement * Placement
Definition nats.h:565
jsStreamConfig::MaxBytes
int64_t MaxBytes
Definition nats.h:555
jsStreamConfig::Replicas
int64_t Replicas
Definition nats.h:561
jsStreamConfig::Sealed
bool Sealed
Seal a stream so no messages can get our or in.
Definition nats.h:569
jsStreamConfig::DenyDelete
bool DenyDelete
Restrict the ability to delete messages.
Definition nats.h:570
jsStreamConsumerLimits
Definition nats.h:463
jsStreamConsumerLimits::MaxAckPending
int MaxAckPending
Definition nats.h:465
jsStreamConsumerLimits::InactiveThreshold
int64_t InactiveThreshold
Definition nats.h:464
jsStreamInfo
Definition nats.h:757
jsStreamInfo::Sources
jsStreamSourceInfo ** Sources
Definition nats.h:763
jsStreamInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:759
jsStreamInfo::Alternates
jsStreamAlternate ** Alternates
Definition nats.h:765
jsStreamInfo::State
jsStreamState State
Definition nats.h:760
jsStreamInfo::Cluster
jsClusterInfo * Cluster
Definition nats.h:761
jsStreamInfo::Mirror
jsStreamSourceInfo * Mirror
Definition nats.h:762
jsStreamInfo::AlternatesLen
int AlternatesLen
Definition nats.h:766
jsStreamInfo::Config
jsStreamConfig * Config
Definition nats.h:758
jsStreamInfo::SourcesLen
int SourcesLen
Definition nats.h:764
jsStreamInfoList
Definition nats.h:778
jsStreamInfoList::List
jsStreamInfo ** List
Definition nats.h:779
jsStreamInfoList::Count
int Count
Definition nats.h:780
jsStreamNamesList
Definition nats.h:792
jsStreamNamesList::List
char ** List
Definition nats.h:793
jsStreamNamesList::Count
int Count
Definition nats.h:794
jsStreamSource
Definition nats.h:424
jsStreamSource::External
jsExternalStream * External
Definition nats.h:429
jsStreamSource::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:427
jsStreamSource::Name
const char * Name
Definition nats.h:425
jsStreamSource::Domain
const char * Domain
Definition nats.h:433
jsStreamSource::OptStartSeq
uint64_t OptStartSeq
Definition nats.h:426
jsStreamSource::FilterSubject
const char * FilterSubject
Definition nats.h:428
jsStreamSourceInfo
Definition nats.h:728
jsStreamSourceInfo::FilterSubject
const char * FilterSubject
Definition nats.h:733
jsStreamSourceInfo::Active
int64_t Active
Definition nats.h:732
jsStreamSourceInfo::SubjectTransformsLen
int SubjectTransformsLen
Definition nats.h:735
jsStreamSourceInfo::Name
char * Name
Definition nats.h:729
jsStreamSourceInfo::External
jsExternalStream * External
Definition nats.h:730
jsStreamSourceInfo::Lag
uint64_t Lag
Definition nats.h:731
jsStreamSourceInfo::SubjectTransforms
jsSubjectTransformConfig * SubjectTransforms
Definition nats.h:734
jsStreamState
Definition nats.h:680
jsStreamState::Lost
jsLostStreamData * Lost
Definition nats.h:692
jsStreamState::LastSeq
uint64_t LastSeq
Definition nats.h:685
jsStreamState::Consumers
int64_t Consumers
Definition nats.h:693
jsStreamState::DeletedLen
int DeletedLen
Definition nats.h:691
jsStreamState::Msgs
uint64_t Msgs
Definition nats.h:681
jsStreamState::Subjects
jsStreamStateSubjects * Subjects
Definition nats.h:688
jsStreamState::FirstSeq
uint64_t FirstSeq
Definition nats.h:683
jsStreamState::LastTime
int64_t LastTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:686
jsStreamState::NumSubjects
int64_t NumSubjects
Definition nats.h:687
jsStreamState::Deleted
uint64_t * Deleted
Definition nats.h:690
jsStreamState::NumDeleted
uint64_t NumDeleted
Definition nats.h:689
jsStreamState::Bytes
uint64_t Bytes
Definition nats.h:682
jsStreamState::FirstTime
int64_t FirstTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:684
jsStreamStateSubject
Definition nats.h:631
jsStreamStateSubject::Msgs
uint64_t Msgs
Definition nats.h:633
jsStreamStateSubject::Subject
const char * Subject
Definition nats.h:632
jsStreamStateSubjects
Definition nats.h:667
jsStreamStateSubjects::Count
int Count
Definition nats.h:669
jsStreamStateSubjects::List
jsStreamStateSubject * List
Definition nats.h:668
jsSubOptions
Definition nats.h:933
jsSubOptions::ManualAck
bool ManualAck
If true, the user will have to acknowledge the messages.
Definition nats.h:978
jsSubOptions::Consumer
const char * Consumer
If specified, the subscription will be bound to an existing consumer from the Stream without attempti...
Definition nats.h:950
jsSubOptions::Stream
const char * Stream
If specified, the consumer will be bound to this stream name.
Definition nats.h:940
jsSubOptions::Ordered
bool Ordered
If true, this will be an ordered consumer.
Definition nats.h:990
jsSubOptions::Queue
const char * Queue
Queue name for queue subscriptions.
Definition nats.h:965
jsSubOptions::Config
jsConsumerConfig Config
Consumer configuration.
Definition nats.h:983
jsSubjectTransformConfig
Definition nats.h:453
jsSubjectTransformConfig::Destination
const char * Destination
Definition nats.h:455
jsSubjectTransformConfig::Source
const char * Source
Definition nats.h:454
jsTier
Definition nats.h:1106
jsTier::Name
const char * Name
Definition nats.h:1107
jsTier::Streams
int64_t Streams
Definition nats.h:1110
jsTier::Store
uint64_t Store
Definition nats.h:1109
jsTier::Consumers
int64_t Consumers
Definition nats.h:1111
jsTier::Memory
uint64_t Memory
Definition nats.h:1108
jsTier::Limits
jsAccountLimits Limits
Definition nats.h:1112
kvConfig
Definition nats.h:1425
kvConfig::History
uint8_t History
Definition nats.h:1429
kvConfig::Bucket
const char * Bucket
Definition nats.h:1426
kvConfig::MaxBytes
int64_t MaxBytes
Definition nats.h:1431
kvConfig::MaxValueSize
int32_t MaxValueSize
Definition nats.h:1428
kvConfig::Replicas
int Replicas
Definition nats.h:1433
kvConfig::Description
const char * Description
Definition nats.h:1427
kvConfig::Mirror
jsStreamSource * Mirror
Definition nats.h:1435
kvConfig::TTL
int64_t TTL
Definition nats.h:1430
kvConfig::StorageType
jsStorageType StorageType
Definition nats.h:1432
kvConfig::RePublish
jsRePublish * RePublish
Definition nats.h:1434
kvConfig::SourcesLen
int SourcesLen
Definition nats.h:1437
kvConfig::Sources
jsStreamSource ** Sources
Definition nats.h:1436
kvEntryList
A list of KeyValue store entries.
Definition nats.h:1496
kvEntryList::Entries
kvEntry ** Entries
Definition nats.h:1497
kvEntryList::Count
int Count
Definition nats.h:1498
kvKeysList
A list of KeyValue store keys.
Definition nats.h:1520
kvKeysList::Count
int Count
Definition nats.h:1522
kvKeysList::Keys
char ** Keys
Definition nats.h:1521
kvPurgeOptions
Definition nats.h:1462
kvPurgeOptions::Timeout
int64_t Timeout
Definition nats.h:1464
kvPurgeOptions::DeleteMarkersOlderThan
int64_t DeleteMarkersOlderThan
Definition nats.h:1474
kvWatchOptions
Definition nats.h:1447
kvWatchOptions::IgnoreDeletes
bool IgnoreDeletes
Definition nats.h:1448
kvWatchOptions::IncludeHistory
bool IncludeHistory
Definition nats.h:1449
kvWatchOptions::Timeout
int64_t Timeout
How long to wait (in milliseconds) for some operations to complete.
Definition nats.h:1451
kvWatchOptions::UpdatesOnly
bool UpdatesOnly
Only receive updates, no initial snapshot.
Definition nats.h:1452
kvWatchOptions::MetaOnly
bool MetaOnly
Definition nats.h:1450
micro_endpoint_config_s
Definition nats.h:7837
micro_endpoint_config_s::Name
const char * Name
The name of the endpoint.
Definition nats.h:7843
micro_endpoint_config_s::Handler
microRequestHandler Handler
The request handler for the endpoint.
Definition nats.h:7877
micro_endpoint_config_s::Subject
const char * Subject
The NATS subject the endpoint will listen on.
Definition nats.h:7854
micro_endpoint_config_s::Metadata
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:7872
micro_endpoint_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:7866
micro_endpoint_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service.
Definition nats.h:7860
micro_endpoint_config_s::State
void * State
A user-provided pointer to store with the endpoint (state/closure).
Definition nats.h:7883
micro_endpoint_info_s
Definition nats.h:7890
micro_endpoint_info_s::Subject
const char * Subject
The semantic version of the service.
Definition nats.h:7899
micro_endpoint_info_s::Name
const char * Name
The name of the service.
Definition nats.h:7894
micro_endpoint_info_s::QueueGroup
const char * QueueGroup
Endpoint's actual queue group (the default "q", or one explicitly set by the user),...
Definition nats.h:7905
micro_endpoint_info_s::Metadata
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:7911
micro_endpoint_stats_s
Definition nats.h:7918
micro_endpoint_stats_s::Subject
const char * Subject
Definition nats.h:7920
micro_endpoint_stats_s::NumRequests
int64_t NumRequests
The number of requests received by the endpoint.
Definition nats.h:7931
micro_endpoint_stats_s::LastErrorString
char LastErrorString[2048]
a copy of the last error message.
Definition nats.h:7957
micro_endpoint_stats_s::ProcessingTimeSeconds
int64_t ProcessingTimeSeconds
total request processing time (the seconds part).
Definition nats.h:7942
micro_endpoint_stats_s::ProcessingTimeNanoseconds
int64_t ProcessingTimeNanoseconds
total request processing time (the nanoseconds part).
Definition nats.h:7947
micro_endpoint_stats_s::QueueGroup
const char * QueueGroup
Endpoint's actual queue group (the default "q", or one explicitly set by the user),...
Definition nats.h:7926
micro_endpoint_stats_s::NumErrors
int64_t NumErrors
The number of errors, service-level and internal, associated with the endpoint.
Definition nats.h:7937
micro_endpoint_stats_s::AverageProcessingTimeNanoseconds
int64_t AverageProcessingTimeNanoseconds
average request processing time, in ns.
Definition nats.h:7952
micro_endpoint_stats_s::Name
const char * Name
Definition nats.h:7919
micro_group_config_s
The Microservice endpoint group configuration object.
Definition nats.h:7964
micro_group_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:7972
micro_group_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service.
Definition nats.h:7969
micro_group_config_s::Prefix
const char * Prefix
The subject prefix for the group.
Definition nats.h:7966
micro_service_config_s
The Microservice top-level configuration object.
Definition nats.h:7982
micro_service_config_s::Description
const char * Description
The description of the service.
Definition nats.h:7998
micro_service_config_s::State
void * State
A user-provided pointer to state data.
Definition nats.h:8062
micro_service_config_s::Version
const char * Version
The (semantic) version of the service.
Definition nats.h:7993
micro_service_config_s::ErrHandler
microErrorHandler ErrHandler
An error notification handler.
Definition nats.h:8043
micro_service_config_s::Metadata
natsMetadata Metadata
Immutable metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:8016
micro_service_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:8010
micro_service_config_s::StatsHandler
microRequestHandler StatsHandler
A custom stats handler.
Definition nats.h:8034
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:8053
micro_service_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service ("q").
Definition nats.h:8004
micro_service_config_s::Name
const char * Name
The name of the service.
Definition nats.h:7988
micro_service_config_s::Endpoint
microEndpointConfig * Endpoint
The "main" (aka default) endpoint configuration.
Definition nats.h:8025
micro_service_info_s
Definition nats.h:8071
micro_service_info_s::Metadata
natsMetadata Metadata
Metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:8100
micro_service_info_s::Name
const char * Name
The name of the service.
Definition nats.h:8080
micro_service_info_s::Version
const char * Version
The semantic version of the service.
Definition nats.h:8085
micro_service_info_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.info_response".
Definition nats.h:8075
micro_service_info_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:8095
micro_service_info_s::Endpoints
microEndpointInfo * Endpoints
Endpoints.
Definition nats.h:8105
micro_service_info_s::Description
const char * Description
The description of the service.
Definition nats.h:8090
micro_service_info_s::EndpointsLen
int EndpointsLen
The number of endpoints in the Endpoints array.
Definition nats.h:8110
micro_service_stats_s
Definition nats.h:8117
micro_service_stats_s::Started
int64_t Started
The timestamp of when the service was started.
Definition nats.h:8141
micro_service_stats_s::EndpointsLen
int EndpointsLen
The number of endpoints in the endpoints array.
Definition nats.h:8151
micro_service_stats_s::Endpoints
microEndpointStats * Endpoints
The stats for each endpoint of the service.
Definition nats.h:8146
micro_service_stats_s::Version
const char * Version
The semantic version of the service.
Definition nats.h:8131
micro_service_stats_s::Name
const char * Name
The name of the service.
Definition nats.h:8126
micro_service_stats_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.stats_response".
Definition nats.h:8121
micro_service_stats_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:8136
natsMetadata
A type to represent user-provided metadata, a list of k=v pairs.
Definition nats.h:255
natsMetadata::Count
int Count
Definition nats.h:259
natsMetadata::List
const char ** List
Definition nats.h:257
natsMsgList
A list of NATS messages.
Definition nats.h:243
natsMsgList::Count
int Count
Definition nats.h:245
natsMsgList::Msgs
natsMsg ** Msgs
Definition nats.h:244