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

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
18 extern "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
37 #if defined(_WIN32)
38 #include <winsock2.h>
39 #if defined(nats_EXPORTS)
40 #define NATS_EXTERN __declspec(dllexport)
41 #elif defined(nats_IMPORTS)
42 #define NATS_EXTERN __declspec(dllimport)
43 #else
44 #define NATS_EXTERN
45 #endif
46
47 typedef SOCKET natsSock;
48 #else
49 #define NATS_EXTERN
50 typedef int natsSock;
51 #endif
52
86 #define NATS_DEFAULT_URL "nats://localhost:4222"
87
97 #define JSMsgSize "Nats-Msg-Size"
98
111 #define JSMsgRollup "Nats-Rollup"
112
120 #define JSMsgRollupSubject "sub"
121
129 #define JSMsgRollupAll "all"
130
131 // Headers for republished messages and direct get.
132 #define JSStream "Nats-Stream"
133 #define JSSequence "Nats-Sequence"
134 #define JSLastSequence "Nats-Last-Sequence"
135 #define JSTimeStamp "Nats-Time-Stamp"
136 #define JSSubject "Nats-Subject"
137
138 //
139 // Types.
140 //
152 typedef struct __natsConnection natsConnection;
153
159 typedef struct __natsStatistics natsStatistics;
160
165 typedef struct __natsSubscription natsSubscription;
166
172 typedef struct __natsMsg natsMsg;
173
178 typedef struct __natsOptions natsOptions;
179
187 typedef char natsInbox;
188
189
195 typedef struct __natsClientConfig
196 {
197 int64_t DefaultWriteDeadline;
198
199 int64_t LockSpinCount;
200
201 // Subscription message delivery thread control
202 bool DefaultToThreadPool;
203 int ThreadPoolMax;
204
205 // Reply message delivery thread control
206 bool DefaultRepliesToThreadPool;
207 bool UseSeparatePoolForReplies;
208 int ReplyThreadPoolMax;
209 } natsClientConfig;
210
234 typedef struct natsMsgList
235 {
236 natsMsg **Msgs;
237 int Count;
238
239 } natsMsgList;
240
246 typedef struct natsMetadata
247 {
248 // User-provided metadata for the stream, encoded as an array of {"key", "value",...}
249 const char **List;
250 // Number of key/value pairs in Metadata, 1/2 of the length of the array.
251 int Count;
252 } natsMetadata;
253
262 typedef struct __jsCtx jsCtx;
263
279 typedef struct jsPubOptions
280 {
281 int64_t MaxWait;
282 const char *MsgId;
283 const char *ExpectStream;
284 const char *ExpectLastMsgId;
285 uint64_t ExpectLastSeq;
286 uint64_t ExpectLastSubjectSeq;
287 bool ExpectNoMessage;
288
289 } jsPubOptions;
290
294 typedef enum
295 {
296 js_LimitsPolicy = 0,
297 js_InterestPolicy,
298 js_WorkQueuePolicy,
299
300 } jsRetentionPolicy;
301
305 typedef enum
306 {
307 js_DiscardOld = 0,
308 js_DiscardNew,
309
310 } jsDiscardPolicy;
311
315 typedef enum
316 {
317 js_FileStorage = 0,
318 js_MemoryStorage,
319
320 } jsStorageType;
321
325 typedef enum
326 {
327 js_StorageCompressionNone = 0,
328 js_StorageCompressionS2,
329 } jsStorageCompression;
330
334 typedef enum
335 {
336 js_DeliverAll = 0,
337 js_DeliverLast,
338 js_DeliverNew,
339 js_DeliverByStartSequence,
340 js_DeliverByStartTime,
341 js_DeliverLastPerSubject,
342
343 } jsDeliverPolicy;
344
348 typedef enum
349 {
350 js_AckExplicit = 0,
351 js_AckNone,
352 js_AckAll,
353
354
355 } jsAckPolicy;
356
360 typedef enum
361 {
362 js_ReplayInstant = 0,
363 js_ReplayOriginal,
364
365 } jsReplayPolicy;
366
367
379 typedef struct jsPlacement
380 {
381 const char *Cluster;
382 const char **Tags;
383 int TagsLen;
384
385 } jsPlacement;
386
396 typedef struct jsExternalStream
397 {
398 const char *APIPrefix;
399 const char *DeliverPrefix;
400
401 } jsExternalStream;
402
415 typedef struct jsStreamSource
416 {
417 const char *Name;
418 uint64_t OptStartSeq;
419 int64_t OptStartTime;
420 const char *FilterSubject;
421 jsExternalStream *External;
422 // Domain and External are mutually exclusive.
423 // If Domain is set, an External value will be created with
424 // the APIPrefix constructed based on the Domain value.
425 const char *Domain;
426
427 } jsStreamSource;
428
432 typedef struct jsRePublish
433 {
434 const char *Source;
435 const char *Destination;
436 bool HeadersOnly;
437
438 } jsRePublish;
439
444 typedef struct jsSubjectTransformConfig
445 {
446 const char *Source;
447 const char *Destination;
448 } jsSubjectTransformConfig;
449
454 typedef struct jsStreamConsumerLimits
455 {
456 int64_t InactiveThreshold;
457 int MaxAckPending;
458 } jsStreamConsumerLimits;
459
539 typedef struct jsStreamConfig {
540 const char *Name;
541 const char *Description;
542 const char **Subjects;
543 int SubjectsLen;
544 jsRetentionPolicy Retention;
545 int64_t MaxConsumers;
546 int64_t MaxMsgs;
547 int64_t MaxBytes;
548 int64_t MaxAge;
549 int64_t MaxMsgsPerSubject;
550 int32_t MaxMsgSize;
551 jsDiscardPolicy Discard;
552 jsStorageType Storage;
553 int64_t Replicas;
554 bool NoAck;
555 const char *Template;
556 int64_t Duplicates;
557 jsPlacement *Placement;
558 jsStreamSource *Mirror;
559 jsStreamSource **Sources;
560 int SourcesLen;
561 bool Sealed;
562 bool DenyDelete;
563 bool DenyPurge;
564
567 bool AllowRollup;
568
571 jsRePublish *RePublish;
572
575 bool AllowDirect;
576
579 bool MirrorDirect;
580
583 bool DiscardNewPerSubject;
584
588 natsMetadata Metadata;
589
592 jsStorageCompression Compression;
593
595 uint64_t FirstSeq;
596
599 jsSubjectTransformConfig SubjectTransform;
600
603 jsStreamConsumerLimits ConsumerLimits;
604 } jsStreamConfig;
605
609 typedef struct jsLostStreamData
610 {
611 uint64_t *Msgs;
612 int MsgsLen;
613 uint64_t Bytes;
614
615 } jsLostStreamData;
616
622 typedef struct jsStreamStateSubject
623 {
624 const char *Subject;
625 uint64_t Msgs;
626
627 } jsStreamStateSubject;
628
658 typedef struct jsStreamStateSubjects
659 {
660 jsStreamStateSubject *List;
661 int Count;
662
663 } jsStreamStateSubjects;
664
671 typedef struct jsStreamState
672 {
673 uint64_t Msgs;
674 uint64_t Bytes;
675 uint64_t FirstSeq;
676 int64_t FirstTime;
677 uint64_t LastSeq;
678 int64_t LastTime;
679 int64_t NumSubjects;
680 jsStreamStateSubjects *Subjects;
681 uint64_t NumDeleted;
682 uint64_t *Deleted;
683 int DeletedLen;
684 jsLostStreamData *Lost;
685 int64_t Consumers;
686
687 } jsStreamState;
688
693 typedef struct jsPeerInfo
694 {
695 char *Name;
696 bool Current;
697 bool Offline;
698 int64_t Active;
699 uint64_t Lag;
700
701 } jsPeerInfo;
702
707 typedef struct jsClusterInfo
708 {
709 char *Name;
710 char *Leader;
711 jsPeerInfo **Replicas;
712 int ReplicasLen;
713
714 } jsClusterInfo;
715
719 typedef struct jsStreamSourceInfo
720 {
721 char *Name;
722 jsExternalStream *External;
723 uint64_t Lag;
724 int64_t Active;
725 const char * FilterSubject;
726 jsSubjectTransformConfig *SubjectTransforms;
727 int SubjectTransformsLen;
728
729 } jsStreamSourceInfo;
730
734 typedef struct jsStreamAlternate
735 {
736 const char *Name;
737 const char *Domain;
738 const char *Cluster;
739
740 } jsStreamAlternate;
741
748 typedef struct jsStreamInfo
749 {
750 jsStreamConfig *Config;
751 int64_t Created;
752 jsStreamState State;
753 jsClusterInfo *Cluster;
754 jsStreamSourceInfo *Mirror;
755 jsStreamSourceInfo **Sources;
756 int SourcesLen;
757 jsStreamAlternate **Alternates;
758 int AlternatesLen;
759
760 } jsStreamInfo;
761
769 typedef struct jsStreamInfoList
770 {
771 jsStreamInfo **List;
772 int Count;
773
774 } jsStreamInfoList;
775
783 typedef struct jsStreamNamesList
784 {
785 char **List;
786 int Count;
787
788 } jsStreamNamesList;
789
833 typedef struct jsConsumerConfig
834 {
835 const char *Name;
836 const char *Durable;
837 const char *Description;
838 jsDeliverPolicy DeliverPolicy;
839 uint64_t OptStartSeq;
840 int64_t OptStartTime;
841 jsAckPolicy AckPolicy;
842 int64_t AckWait;
843 int64_t MaxDeliver;
844 int64_t *BackOff;
845 int BackOffLen;
846 const char *FilterSubject;
847 jsReplayPolicy ReplayPolicy;
848 uint64_t RateLimit;
849 const char *SampleFrequency;
850 int64_t MaxWaiting;
851 int64_t MaxAckPending;
852 bool FlowControl;
853 int64_t Heartbeat;
854 bool HeadersOnly;
855
856 // Pull based options.
857 int64_t MaxRequestBatch;
858 int64_t MaxRequestExpires;
859 int64_t MaxRequestMaxBytes;
860
861 // Push based options.
862 const char *DeliverSubject;
863 const char *DeliverGroup;
864
865 // Ephemeral inactivity threshold.
866 int64_t InactiveThreshold;
867
868 // Generally inherited by parent stream and other markers, now can be configured directly.
869 int64_t Replicas;
870 // Force memory storage.
871 bool MemoryStorage;
872
873 // Configuration options introduced in 2.10
874
875 const char **FilterSubjects;
876 int FilterSubjectsLen;
877 natsMetadata Metadata;
878
879 // Configuration options introduced in 2.11
880
881 int64_t PauseUntil;
882 } jsConsumerConfig;
883
901 typedef struct jsConsumerSequenceMismatch
902 {
903 uint64_t Stream;
904 uint64_t ConsumerClient;
905 uint64_t ConsumerServer;
906
907 } jsConsumerSequenceMismatch;
908
924 typedef struct jsSubOptions
925 {
932 const char *Stream;
942 const char *Consumer;
957 const char *Queue;
970 bool ManualAck;
975 jsConsumerConfig Config;
982 bool Ordered;
983
984 } jsSubOptions;
985
989 typedef struct jsSequencePair
990 {
991 uint64_t Consumer;
992 uint64_t Stream;
993
994 } jsSequencePair;
995
999 typedef struct jsSequenceInfo
1000 {
1001 uint64_t Consumer;
1002 uint64_t Stream;
1003 int64_t Last;
1004
1005 } jsSequenceInfo;
1006
1013 typedef struct jsConsumerInfo
1014 {
1015 char *Stream;
1016 char *Name;
1017 int64_t Created;
1018 jsConsumerConfig *Config;
1019 jsSequenceInfo Delivered;
1020 jsSequenceInfo AckFloor;
1021 int64_t NumAckPending;
1022 int64_t NumRedelivered;
1023 int64_t NumWaiting;
1024 uint64_t NumPending;
1025 jsClusterInfo *Cluster;
1026 bool PushBound;
1027 bool Paused;
1028 int64_t PauseRemaining;
1029 } jsConsumerInfo;
1030
1038 typedef struct jsConsumerInfoList
1039 {
1040 jsConsumerInfo **List;
1041 int Count;
1042
1043 } jsConsumerInfoList;
1044
1052 typedef struct jsConsumerNamesList
1053 {
1054 char **List;
1055 int Count;
1056
1057 } jsConsumerNamesList;
1058
1064 typedef struct jsConsumerPauseResponse
1065 {
1066 bool Paused;
1067 int64_t PauseUntil;
1068 int64_t PauseRemaining;
1069 } jsConsumerPauseResponse;
1070
1074 typedef struct jsAPIStats
1075 {
1076 uint64_t Total;
1077 uint64_t Errors;
1078
1079 } jsAPIStats;
1080
1084 typedef struct jsAccountLimits
1085 {
1086 int64_t MaxMemory;
1087 int64_t MaxStore;
1088 int64_t MaxStreams;
1089 int64_t MaxConsumers;
1090 int64_t MaxAckPending;
1091 int64_t MemoryMaxStreamBytes;
1092 int64_t StoreMaxStreamBytes;
1093 bool MaxBytesRequired;
1094
1095 } jsAccountLimits;
1096
1097 typedef struct jsTier
1098 {
1099 const char *Name;
1100 uint64_t Memory;
1101 uint64_t Store;
1102 int64_t Streams;
1103 int64_t Consumers;
1104 jsAccountLimits Limits;
1105
1106 } jsTier;
1107
1111 typedef struct jsAccountInfo
1112 {
1113 uint64_t Memory;
1114 uint64_t Store;
1115 int64_t Streams;
1116 int64_t Consumers;
1117 char *Domain;
1118 jsAPIStats API;
1119 jsAccountLimits Limits;
1120 jsTier **Tiers;
1121 int TiersLen;
1122
1123 } jsAccountInfo;
1124
1132 typedef struct jsMsgMetaData
1133 {
1134 jsSequencePair Sequence;
1135 uint64_t NumDelivered;
1136 uint64_t NumPending;
1137 int64_t Timestamp;
1138 char *Stream;
1139 char *Consumer;
1140 char *Domain;
1141
1142 } jsMsgMetaData;
1143
1147 typedef struct jsPubAck
1148 {
1149 char *Stream;
1150 uint64_t Sequence;
1151 char *Domain;
1152 bool Duplicate;
1153
1154 } jsPubAck;
1155
1160 typedef struct jsPubAckErr
1161 {
1162 natsMsg *Msg;
1163 natsStatus Err;
1164 jsErrCode ErrCode;
1165 const char *ErrText;
1166
1167 } jsPubAckErr;
1168
1169 #ifndef BUILD_IN_DOXYGEN
1170 // Forward declarations
1171 typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
1172 typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
1173 #endif
1174
1184 typedef struct jsDirectGetMsgOptions
1185 {
1186 uint64_t Sequence;
1187 const char *NextBySubject;
1188 const char *LastBySubject;
1189
1190 } jsDirectGetMsgOptions;
1191
1197 typedef struct jsFetchRequest
1198 {
1199 int64_t Expires;
1200 int Batch;
1201 int64_t MaxBytes;
1202 bool NoWait;
1203 int64_t Heartbeat;
1204
1205 } jsFetchRequest;
1206
1228 typedef void (*jsFetchCompleteHandler)(natsConnection *nc, natsSubscription *sub, natsStatus s, void *closure);
1229
1240 typedef bool (*jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure);
1241
1247 typedef struct jsOptions
1248 {
1249 const char *Prefix;
1250 const char *Domain;
1251 int64_t Wait;
1252
1253 struct jsOptionsPublishAsync
1254 {
1255 int64_t MaxPending;
1256
1257 // If jsPubAckHandler is specified, the callback will be invoked
1258 // for every asynchronous published message, either as a positive
1259 // result, or with the error encountered when publishing that
1260 // message. If this callback is specified, ErrHandler (see below)
1261 // will be ignored.
1262 jsPubAckHandler AckHandler;
1263 void *AckHandlerClosure;
1264
1265 // This callback is invoked for messages published asynchronously
1266 // when an error is returned by the server or if the library has
1267 // timed-out waiting for an acknowledgment back from the server
1268 // (if publish uses the jsPubOptions.MaxWait).
1269 jsPubAckErrHandler ErrHandler;
1270 void *ErrHandlerClosure;
1271
1272 int64_t StallWait;
1273
1274 } PublishAsync;
1275
1276 struct jsOptionsPullSubscribeAsync
1277 {
1278 int64_t Timeout;
1279 int MaxMessages;
1280 int64_t MaxBytes;
1281
1289 bool NoWait;
1290
1294 jsFetchCompleteHandler CompleteHandler;
1295 void *CompleteHandlerClosure;
1296
1299 int64_t Heartbeat;
1300
1304 int FetchSize;
1305
1312 int KeepAhead;
1313
1319 jsFetchNextHandler NextHandler;
1320 void *NextHandlerClosure;
1321
1322 } PullSubscribeAsync;
1323
1324
1331 struct jsOptionsStream
1332 {
1342 struct jsOptionsStreamPurge
1343 {
1344 const char *Subject;
1345 uint64_t Sequence;
1346 uint64_t Keep;
1347
1348 } Purge;
1349
1353 struct jsOptionsStreamInfo
1354 {
1355 bool DeletedDetails;
1356 const char *SubjectsFilter;
1357
1358 } Info;
1359
1360 } Stream;
1361
1362 } jsOptions;
1363
1367 typedef struct __kvStore kvStore;
1368
1372 typedef struct __kvEntry kvEntry;
1373
1377 typedef struct __kvStatus kvStatus;
1378
1382 typedef struct __kvWatcher kvWatcher;
1383
1387 typedef enum
1388 {
1389 kvOp_Unknown = 0,
1390 kvOp_Put,
1391 kvOp_Delete,
1392 kvOp_Purge,
1393
1394 } kvOperation;
1395
1401 typedef struct kvConfig
1402 {
1403 const char *Bucket;
1404 const char *Description;
1405 int32_t MaxValueSize;
1406 uint8_t History;
1407 int64_t TTL;
1408 int64_t MaxBytes;
1409 jsStorageType StorageType;
1410 int Replicas;
1411 jsRePublish *RePublish;
1412 jsStreamSource *Mirror;
1413 jsStreamSource **Sources;
1414 int SourcesLen;
1415
1416 } kvConfig;
1417
1423 typedef struct kvWatchOptions
1424 {
1425 bool IgnoreDeletes;
1426 bool IncludeHistory;
1427 bool MetaOnly;
1428 int64_t Timeout;
1429
1430 } kvWatchOptions;
1431
1437 typedef struct kvPurgeOptions
1438 {
1439 // How long to wait (in milliseconds) for some operations to complete.
1440 int64_t Timeout;
1441
1442 // When calling kvStore_PurgeDeletes(), all keys that have a delete or
1443 // purge marker as the last entry are gathered and then those keys
1444 // are purged of their content, including the marker.
1445 // Starting with NATS C client v3.3.0, if this option is not specified,
1446 // only the markers older than 30 minutes will be deleted. Use this
1447 // option to set the limit or a negative value to force removal of
1448 // markers regardless of their age.
1449 // The value is expressed as a time in nanoseconds.
1450 int64_t DeleteMarkersOlderThan;
1451
1452 } kvPurgeOptions;
1453
1471 typedef struct kvEntryList
1472 {
1473 kvEntry **Entries;
1474 int Count;
1475
1476 } kvEntryList;
1477
1495 typedef struct kvKeysList
1496 {
1497 char **Keys;
1498 int Count;
1499
1500 } kvKeysList;
1501
1502 #if defined(NATS_HAS_STREAMING)
1507 typedef struct __stanConnection stanConnection;
1508
1513 typedef struct __stanSubscription stanSubscription;
1514
1519 typedef struct __stanMsg stanMsg;
1520
1525 typedef struct __stanConnOptions stanConnOptions;
1526
1531 typedef struct __stanSubOptions stanSubOptions;
1532 #endif
1533 // end of typesGroup
1535
1536 //
1537 // Callbacks.
1538 //
1539
1562 typedef void (*natsMsgHandler)(
1563 natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure);
1564
1578 typedef void (*natsConnectionHandler)(
1579 natsConnection *nc, void *closure);
1580
1587 typedef void (*natsErrHandler)(
1588 natsConnection *nc, natsSubscription *subscription, natsStatus err,
1589 void *closure);
1590
1604 typedef natsStatus (*natsEvLoop_Attach)(
1605 void **userData,
1606 void *loop,
1607 natsConnection *nc,
1608 natsSock socket);
1609
1619 typedef natsStatus (*natsEvLoop_ReadAddRemove)(
1620 void *userData,
1621 bool add);
1622
1632 typedef natsStatus (*natsEvLoop_WriteAddRemove)(
1633 void *userData,
1634 bool add);
1635
1643 typedef natsStatus (*natsEvLoop_Detach)(
1644 void *userData);
1645
1667 typedef natsStatus (*natsUserJWTHandler)(
1668 char **userJWT,
1669 char **customErrTxt,
1670 void *closure);
1671
1672
1698 typedef natsStatus (*natsSignatureHandler)(
1699 char **customErrTxt,
1700 unsigned char **signature,
1701 int *signatureLength,
1702 const char *nonce,
1703 void *closure);
1704
1713 typedef const char* (*natsTokenHandler)(void *closure);
1714
1715
1723 typedef void (*natsOnCompleteCB)(void *closure);
1724
1745 typedef int64_t (*natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure);
1746
1747 #ifdef BUILD_IN_DOXYGEN
1781 typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
1782
1824 typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
1825 #endif
1826
1827 #if defined(NATS_HAS_STREAMING)
1836 typedef void (*stanPubAckHandler)(const char *guid, const char *error, void *closure);
1837
1847 typedef void (*stanMsgHandler)(
1848 stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure);
1849
1856 typedef void (*stanConnectionLostHandler)(
1857 stanConnection *sc, const char* errorTxt, void *closure);
1858 #endif
1859 // end of callbacksGroup
1861
1862 //
1863 // Functions.
1864 //
1891 natsStatus
1892 nats_OpenWithConfig(natsClientConfig *config);
1893
1907 NATS_EXTERN natsStatus
1908 nats_Open(int64_t lockSpinCount);
1909
1910
1915 NATS_EXTERN const char*
1916 nats_GetVersion(void);
1917
1925 NATS_EXTERN uint32_t
1926 nats_GetVersionNumber(void);
1927
1928 #ifdef BUILD_IN_DOXYGEN
1943 NATS_EXTERN bool nats_CheckCompatibility(void);
1944 #else
1945
1946 #define nats_CheckCompatibility() nats_CheckCompatibilityImpl(NATS_VERSION_REQUIRED_NUMBER, \
1947 NATS_VERSION_NUMBER, \
1948 NATS_VERSION_STRING)
1949
1950 NATS_EXTERN bool
1951 nats_CheckCompatibilityImpl(uint32_t reqVerNumber, uint32_t verNumber, const char *verString);
1952
1953 #endif
1954
1959 NATS_EXTERN int64_t
1960 nats_Now(void);
1961
1967 NATS_EXTERN int64_t
1968 nats_NowInNanoSeconds(void);
1969
1977 NATS_EXTERN void
1978 nats_Sleep(int64_t sleepTime);
1979
1992 NATS_EXTERN const char*
1993 nats_GetLastError(natsStatus *status);
1994
2003 NATS_EXTERN natsStatus
2004 nats_GetLastErrorStack(char *buffer, size_t bufLen);
2005
2026 NATS_EXTERN void
2027 nats_PrintLastErrorStack(FILE *file);
2028
2058 NATS_EXTERN natsStatus
2059 nats_SetMessageDeliveryPoolSize(int max);
2060
2071 NATS_EXTERN void
2072 nats_ReleaseThreadMemory(void);
2073
2098 NATS_EXTERN natsStatus
2099 nats_Sign(const char *encodedSeed,
2100 const char *input,
2101 unsigned char **signature,
2102 int *signatureLength);
2103
2124 NATS_EXTERN void
2125 nats_Close(void);
2126
2172 NATS_EXTERN natsStatus
2173 nats_CloseAndWait(int64_t timeout);
2174 // end of libraryGroup
2176
2192 NATS_EXTERN const char*
2193 natsStatus_GetText(natsStatus s);
2194 // end of statusGroup
2196
2214 NATS_EXTERN natsStatus
2215 natsStatistics_Create(natsStatistics **newStats);
2216
2233 NATS_EXTERN natsStatus
2234 natsStatistics_GetCounts(const natsStatistics *stats,
2235 uint64_t *inMsgs, uint64_t *inBytes,
2236 uint64_t *outMsgs, uint64_t *outBytes,
2237 uint64_t *reconnects);
2238
2245 NATS_EXTERN void
2246 natsStatistics_Destroy(natsStatistics *stats);
2247 // end of statsGroup
2249
2274 NATS_EXTERN natsStatus
2275 natsOptions_Create(natsOptions **newOpts);
2276
2298 /*
2299 * The above is for doxygen. The proper syntax for username/password
2300 * is without the '\' character:
2301 *
2302 * nats://localhost:4222
2303 * nats://user@localhost:4222
2304 * nats://user:password@localhost:4222
2305 */
2306 NATS_EXTERN natsStatus
2307 natsOptions_SetURL(natsOptions *opts, const char *url);
2308
2323 NATS_EXTERN natsStatus
2324 natsOptions_SetServers(natsOptions *opts, const char** servers, int serversCount);
2325
2351 NATS_EXTERN natsStatus
2352 natsOptions_SetUserInfo(natsOptions *opts, const char *user, const char *password);
2353
2378 NATS_EXTERN natsStatus
2379 natsOptions_SetToken(natsOptions *opts, const char *token);
2380
2396 NATS_EXTERN natsStatus
2397 natsOptions_SetTokenHandler(natsOptions *opts, natsTokenHandler tokenCb,
2398 void *closure);
2399
2409 NATS_EXTERN natsStatus
2410 natsOptions_SetNoRandomize(natsOptions *opts, bool noRandomize);
2411
2424 NATS_EXTERN natsStatus
2425 natsOptions_SetTimeout(natsOptions *opts, int64_t timeout);
2426
2434 NATS_EXTERN natsStatus
2435 natsOptions_SetName(natsOptions *opts, const char *name);
2436
2446 NATS_EXTERN natsStatus
2447 natsOptions_SetSecure(natsOptions *opts, bool secure);
2448
2463 NATS_EXTERN natsStatus
2464 natsOptions_TLSHandshakeFirst(natsOptions *opts);
2465
2479 NATS_EXTERN natsStatus
2480 natsOptions_LoadCATrustedCertificates(natsOptions *opts, const char *fileName);
2481
2507 NATS_EXTERN natsStatus
2508 natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates);
2509
2524 NATS_EXTERN natsStatus
2525 natsOptions_LoadCertificatesChain(natsOptions *opts,
2526 const char *certsFileName,
2527 const char *keyFileName);
2528
2540 NATS_EXTERN natsStatus
2541 natsOptions_SetCertificatesChain(natsOptions *opts,
2542 const char *cert,
2543 const char *key);
2544
2560 NATS_EXTERN natsStatus
2561 natsOptions_SetCiphers(natsOptions *opts, const char *ciphers);
2562
2576 NATS_EXTERN natsStatus
2577 natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers);
2578
2588 NATS_EXTERN natsStatus
2589 natsOptions_SetExpectedHostname(natsOptions *opts, const char *hostname);
2590
2601 NATS_EXTERN natsStatus
2602 natsOptions_SkipServerVerification(natsOptions *opts, bool skip);
2603
2614 NATS_EXTERN natsStatus
2615 natsOptions_SetVerbose(natsOptions *opts, bool verbose);
2616
2627 NATS_EXTERN natsStatus
2628 natsOptions_SetPedantic(natsOptions *opts, bool pedantic);
2629
2639 NATS_EXTERN natsStatus
2640 natsOptions_SetPingInterval(natsOptions *opts, int64_t interval);
2641
2653 NATS_EXTERN natsStatus
2654 natsOptions_SetMaxPingsOut(natsOptions *opts, int maxPingsOut);
2655
2667 NATS_EXTERN natsStatus
2668 natsOptions_SetIOBufSize(natsOptions *opts, int ioBufSize);
2669
2681 NATS_EXTERN natsStatus
2682 natsOptions_SetAllowReconnect(natsOptions *opts, bool allow);
2683
2691 NATS_EXTERN natsStatus
2692 natsOptions_SetMaxReconnect(natsOptions *opts, int maxReconnect);
2693
2707 NATS_EXTERN natsStatus
2708 natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait);
2709
2733 NATS_EXTERN natsStatus
2734 natsOptions_SetReconnectJitter(natsOptions *opts, int64_t jitter, int64_t jitterTLS);
2735
2754 NATS_EXTERN natsStatus
2755 natsOptions_SetCustomReconnectDelay(natsOptions *opts,
2756 natsCustomReconnectDelayHandler cb,
2757 void *closure);
2758
2771 NATS_EXTERN natsStatus
2772 natsOptions_SetReconnectBufSize(natsOptions *opts, int reconnectBufSize);
2773
2787 NATS_EXTERN natsStatus
2788 natsOptions_SetMaxPendingMsgs(natsOptions *opts, int maxPending);
2789
2803 NATS_EXTERN natsStatus
2804 natsOptions_SetMaxPendingBytes(natsOptions* opts, int64_t maxPending);
2805
2820 NATS_EXTERN natsStatus
2821 natsOptions_SetErrorHandler(natsOptions *opts, natsErrHandler errHandler,
2822 void *closure);
2823
2836 NATS_EXTERN natsStatus
2837 natsOptions_SetClosedCB(natsOptions *opts, natsConnectionHandler closedCb,
2838 void *closure);
2839
2856 NATS_EXTERN natsStatus
2857 natsOptions_SetDisconnectedCB(natsOptions *opts,
2858 natsConnectionHandler disconnectedCb,
2859 void *closure);
2860
2876 NATS_EXTERN natsStatus
2877 natsOptions_SetReconnectedCB(natsOptions *opts,
2878 natsConnectionHandler reconnectedCb,
2879 void *closure);
2880
2895 NATS_EXTERN natsStatus
2896 natsOptions_SetDiscoveredServersCB(natsOptions *opts,
2897 natsConnectionHandler discoveredServersCb,
2898 void *closure);
2899
2913 NATS_EXTERN natsStatus
2914 natsOptions_SetIgnoreDiscoveredServers(natsOptions *opts, bool ignore);
2915
2932 NATS_EXTERN natsStatus
2933 natsOptions_SetLameDuckModeCB(natsOptions *opts,
2934 natsConnectionHandler lameDuckCb,
2935 void *closure);
2936
2954 NATS_EXTERN natsStatus
2955 natsOptions_SetEventLoop(natsOptions *opts,
2956 void *loop,
2957 natsEvLoop_Attach attachCb,
2958 natsEvLoop_ReadAddRemove readCb,
2959 natsEvLoop_WriteAddRemove writeCb,
2960 natsEvLoop_Detach detachCb);
2961
2984 NATS_EXTERN natsStatus
2985 natsOptions_UseGlobalMessageDelivery(natsOptions *opts, bool global);
2986
3009 NATS_EXTERN natsStatus
3010 natsOptions_IPResolutionOrder(natsOptions *opts, int order);
3011
3039 NATS_EXTERN natsStatus
3040 natsOptions_SetSendAsap(natsOptions *opts, bool sendAsap);
3041
3051 NATS_EXTERN natsStatus
3052 natsOptions_UseOldRequestStyle(natsOptions *opts, bool useOldStyle);
3053
3068 NATS_EXTERN natsStatus
3069 natsOptions_SetFailRequestsOnDisconnect(natsOptions *opts, bool failRequests);
3070
3089 NATS_EXTERN natsStatus
3090 natsOptions_SetNoEcho(natsOptions *opts, bool noEcho);
3091
3145 NATS_EXTERN natsStatus
3146 natsOptions_SetRetryOnFailedConnect(natsOptions *opts, bool retry,
3147 natsConnectionHandler connectedCb, void* closure);
3148
3177 NATS_EXTERN natsStatus
3178 natsOptions_SetUserCredentialsCallbacks(natsOptions *opts,
3179 natsUserJWTHandler ujwtCB,
3180 void *ujwtClosure,
3181 natsSignatureHandler sigCB,
3182 void *sigClosure);
3183
3222 NATS_EXTERN natsStatus
3223 natsOptions_SetUserCredentialsFromFiles(natsOptions *opts,
3224 const char *userOrChainedFile,
3225 const char *seedFile);
3226
3239 NATS_EXTERN natsStatus
3240 natsOptions_SetUserCredentialsFromMemory(natsOptions *opts,
3241 const char *jwtAndSeedContent);
3242
3266 NATS_EXTERN natsStatus
3267 natsOptions_SetNKey(natsOptions *opts,
3268 const char *pubKey,
3269 natsSignatureHandler sigCB,
3270 void *sigClosure);
3271
3296 NATS_EXTERN natsStatus
3297 natsOptions_SetNKeyFromSeed(natsOptions *opts,
3298 const char *pubKey,
3299 const char *seedFile);
3300
3314 NATS_EXTERN natsStatus
3315 natsOptions_SetWriteDeadline(natsOptions *opts, int64_t deadline);
3316
3351 NATS_EXTERN natsStatus
3352 natsOptions_DisableNoResponders(natsOptions *opts, bool disabled);
3353
3369 NATS_EXTERN natsStatus
3370 natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix);
3371
3385 NATS_EXTERN natsStatus
3386 natsOptions_SetMessageBufferPadding(natsOptions *opts, int paddingSize);
3387
3395 NATS_EXTERN void
3396 natsOptions_Destroy(natsOptions *opts);
3397 // end of optsGroup
3399
3400 #if defined(NATS_HAS_STREAMING)
3434 NATS_EXTERN natsStatus
3435 stanConnOptions_Create(stanConnOptions **newOpts);
3436
3458 NATS_EXTERN natsStatus
3459 stanConnOptions_SetURL(stanConnOptions *opts, const char *url);
3460
3477 NATS_EXTERN natsStatus
3478 stanConnOptions_SetNATSOptions(stanConnOptions *opts, natsOptions *nOpts);
3479
3489 NATS_EXTERN natsStatus
3490 stanConnOptions_SetConnectionWait(stanConnOptions *opts, int64_t wait);
3491
3501 NATS_EXTERN natsStatus
3502 stanConnOptions_SetPubAckWait(stanConnOptions *opts, int64_t wait);
3503
3511 NATS_EXTERN natsStatus
3512 stanConnOptions_SetDiscoveryPrefix(stanConnOptions *opts, const char *prefix);
3513
3514
3529 NATS_EXTERN natsStatus
3530 stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage);
3531
3547 NATS_EXTERN natsStatus
3548 stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut);
3549
3560 NATS_EXTERN natsStatus
3561 stanConnOptions_SetConnectionLostHandler(stanConnOptions *opts, stanConnectionLostHandler handler, void *closure);
3562
3570 NATS_EXTERN void
3571 stanConnOptions_Destroy(stanConnOptions *opts);
3572 // end of stanConnOptsGroup
3574
3605 NATS_EXTERN natsStatus
3606 stanSubOptions_Create(stanSubOptions **newOpts);
3607
3626 NATS_EXTERN natsStatus
3627 stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName);
3628
3642 NATS_EXTERN natsStatus
3643 stanSubOptions_SetAckWait(stanSubOptions *opts, int64_t wait);
3644
3656 NATS_EXTERN natsStatus
3657 stanSubOptions_SetMaxInflight(stanSubOptions *opts, int maxInflight);
3658
3674 NATS_EXTERN natsStatus
3675 stanSubOptions_StartAtSequence(stanSubOptions *opts, uint64_t seq);
3676
3691 NATS_EXTERN natsStatus
3692 stanSubOptions_StartAtTime(stanSubOptions *opts, int64_t time);
3693
3705 NATS_EXTERN natsStatus
3706 stanSubOptions_StartAtTimeDelta(stanSubOptions *opts, int64_t delta);
3707
3716 NATS_EXTERN natsStatus
3717 stanSubOptions_StartWithLastReceived(stanSubOptions *opts);
3718
3726 NATS_EXTERN natsStatus
3727 stanSubOptions_DeliverAllAvailable(stanSubOptions *opts);
3728
3743 NATS_EXTERN natsStatus
3744 stanSubOptions_SetManualAckMode(stanSubOptions *opts, bool manual);
3745
3753 NATS_EXTERN void
3754 stanSubOptions_Destroy(stanSubOptions *opts);
3755 // end of stanSubOptsGroup
3757 #endif
3758
3778 NATS_EXTERN natsStatus
3779 natsInbox_Create(natsInbox **newInbox);
3780
3787 NATS_EXTERN void
3788 natsInbox_Destroy(natsInbox *inbox);
3789 // end of inboxGroup
3791
3810 NATS_EXTERN void
3811 natsMsgList_Destroy(natsMsgList *list);
3812
3830 NATS_EXTERN natsStatus
3831 natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply,
3832 const char *data, int dataLen);
3833
3842 NATS_EXTERN const char*
3843 natsMsg_GetSubject(const natsMsg *msg);
3844
3854 NATS_EXTERN const char*
3855 natsMsg_GetReply(const natsMsg *msg);
3856
3872 NATS_EXTERN const char*
3873 natsMsg_GetData(const natsMsg *msg);
3874
3881 NATS_EXTERN int
3882 natsMsg_GetDataLength(const natsMsg *msg);
3883
3899 NATS_EXTERN natsStatus
3900 natsMsgHeader_Set(natsMsg *msg, const char *key, const char *value);
3901
3917 NATS_EXTERN natsStatus
3918 natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value);
3919
3938 NATS_EXTERN natsStatus
3939 natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value);
3940
3974 NATS_EXTERN natsStatus
3975 natsMsgHeader_Values(natsMsg *msg, const char *key, const char* **values, int *count);
3976
4006 NATS_EXTERN natsStatus
4007 natsMsgHeader_Keys(natsMsg *msg, const char* **keys, int *count);
4008
4022 NATS_EXTERN natsStatus
4023 natsMsgHeader_Delete(natsMsg *msg, const char *key);
4024
4050 NATS_EXTERN bool
4051 natsMsg_IsNoResponders(natsMsg *msg);
4052
4059 NATS_EXTERN void
4060 natsMsg_Destroy(natsMsg *msg);
4061 // end of msgGroup
4063
4064 #if defined(NATS_HAS_STREAMING)
4077 NATS_EXTERN uint64_t
4078 stanMsg_GetSequence(const stanMsg *msg);
4079
4086 NATS_EXTERN int64_t
4087 stanMsg_GetTimestamp(const stanMsg *msg);
4088
4097 NATS_EXTERN bool
4098 stanMsg_IsRedelivered(const stanMsg *msg);
4099
4115 NATS_EXTERN const char*
4116 stanMsg_GetData(const stanMsg *msg);
4117
4124 NATS_EXTERN int
4125 stanMsg_GetDataLength(const stanMsg *msg);
4126
4133 NATS_EXTERN void
4134 stanMsg_Destroy(stanMsg *msg);
4135 // end of stanMsgGroup
4137 #endif
4138
4169 NATS_EXTERN natsStatus
4170 natsConnection_Connect(natsConnection **nc, natsOptions *options);
4171
4181 natsStatus
4182 natsConnection_Reconnect(natsConnection *nc);
4183
4194 NATS_EXTERN void
4195 natsConnection_ProcessReadEvent(natsConnection *nc);
4196
4207 NATS_EXTERN void
4208 natsConnection_ProcessWriteEvent(natsConnection *nc);
4209
4228 NATS_EXTERN natsStatus
4229 natsConnection_ConnectTo(natsConnection **nc, const char *urls);
4230
4237 NATS_EXTERN bool
4238 natsConnection_IsClosed(natsConnection *nc);
4239
4246 NATS_EXTERN bool
4247 natsConnection_IsReconnecting(natsConnection *nc);
4248
4255 NATS_EXTERN bool
4256 natsConnection_IsDraining(natsConnection *nc);
4257
4266 NATS_EXTERN natsConnStatus
4267 natsConnection_Status(natsConnection *nc);
4268
4280 NATS_EXTERN int
4281 natsConnection_Buffered(natsConnection *nc);
4282
4298 NATS_EXTERN natsStatus
4299 natsConnection_Flush(natsConnection *nc);
4300
4313 NATS_EXTERN natsStatus
4314 natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout);
4315
4325 NATS_EXTERN int64_t
4326 natsConnection_GetMaxPayload(natsConnection *nc);
4327
4337 NATS_EXTERN natsStatus
4338 natsConnection_GetStats(natsConnection *nc, natsStatistics *stats);
4339
4349 NATS_EXTERN natsStatus
4350 natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize);
4351
4361 NATS_EXTERN natsStatus
4362 natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize);
4363
4384 NATS_EXTERN natsStatus
4385 natsConnection_GetServers(natsConnection *nc, char ***servers, int *count);
4386
4407 NATS_EXTERN natsStatus
4408 natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count);
4409
4422 NATS_EXTERN natsStatus
4423 natsConnection_GetLastError(natsConnection *nc, const char **lastError);
4424
4438 NATS_EXTERN natsStatus
4439 natsConnection_GetClientID(natsConnection *nc, uint64_t *cid);
4440
4459 NATS_EXTERN natsStatus
4460 natsConnection_Drain(natsConnection *nc);
4461
4479 NATS_EXTERN natsStatus
4480 natsConnection_DrainTimeout(natsConnection *nc, int64_t timeout);
4481
4494 NATS_EXTERN natsStatus
4495 natsConnection_Sign(natsConnection *nc,
4496 const unsigned char *message, int messageLen,
4497 unsigned char sig[64]);
4498
4517 NATS_EXTERN natsStatus
4518 natsConnection_GetClientIP(natsConnection *nc, char **ip);
4519
4530 NATS_EXTERN natsStatus
4531 natsConnection_GetRTT(natsConnection *nc, int64_t *rtt);
4532
4540 NATS_EXTERN natsStatus
4541 natsConnection_HasHeaderSupport(natsConnection *nc);
4542
4562 NATS_EXTERN natsStatus
4563 natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port);
4564
4574 NATS_EXTERN void
4575 natsConnection_Close(natsConnection *nc);
4576
4584 NATS_EXTERN void
4585 natsConnection_Destroy(natsConnection *nc);
4586 // end of connMgtGroup
4588
4605 NATS_EXTERN natsStatus
4606 natsConnection_Publish(natsConnection *nc, const char *subj,
4607 const void *data, int dataLen);
4608
4623 NATS_EXTERN natsStatus
4624 natsConnection_PublishString(natsConnection *nc, const char *subj,
4625 const char *str);
4626
4637 NATS_EXTERN natsStatus
4638 natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg);
4639
4652 NATS_EXTERN natsStatus
4653 natsConnection_PublishRequest(natsConnection *nc, const char *subj,
4654 const char *reply, const void *data, int dataLen);
4655
4672 NATS_EXTERN natsStatus
4673 natsConnection_PublishRequestString(natsConnection *nc, const char *subj,
4674 const char *reply, const char *str);
4675
4693 NATS_EXTERN natsStatus
4694 natsConnection_Request(natsMsg **replyMsg, natsConnection *nc, const char *subj,
4695 const void *data, int dataLen, int64_t timeout);
4696
4718 NATS_EXTERN natsStatus
4719 natsConnection_RequestString(natsMsg **replyMsg, natsConnection *nc,
4720 const char *subj, const char *str,
4721 int64_t timeout);
4722
4737 NATS_EXTERN natsStatus
4738 natsConnection_RequestMsg(natsMsg **replyMsg, natsConnection *nc,
4739 natsMsg *requestMsg, int64_t timeout);
4740 // end of connPubGroup
4742
4763 NATS_EXTERN natsStatus
4764 natsConnection_Subscribe(natsSubscription **sub, natsConnection *nc,
4765 const char *subject, natsMsgHandler cb,
4766 void *cbClosure);
4767
4798 NATS_EXTERN natsStatus
4799 natsConnection_SubscribeTimeout(natsSubscription **sub, natsConnection *nc,
4800 const char *subject, int64_t timeout,
4801 natsMsgHandler cb, void *cbClosure);
4802
4813 NATS_EXTERN natsStatus
4814 natsConnection_SubscribeSync(natsSubscription **sub, natsConnection *nc,
4815 const char *subject);
4816
4834 NATS_EXTERN natsStatus
4835 natsConnection_QueueSubscribe(natsSubscription **sub, natsConnection *nc,
4836 const char *subject, const char *queueGroup,
4837 natsMsgHandler cb, void *cbClosure);
4838
4871 NATS_EXTERN natsStatus
4872 natsConnection_QueueSubscribeTimeout(natsSubscription **sub, natsConnection *nc,
4873 const char *subject, const char *queueGroup,
4874 int64_t timeout, natsMsgHandler cb, void *cbClosure);
4875
4887 NATS_EXTERN natsStatus
4888 natsConnection_QueueSubscribeSync(natsSubscription **sub, natsConnection *nc,
4889 const char *subject, const char *queueGroup);
4890 // end of connSubGroup
4892 // end of connGroup
4894
4913 NATS_EXTERN natsStatus
4914 natsSubscription_NoDeliveryDelay(natsSubscription *sub);
4915
4938 NATS_EXTERN natsStatus
4939 natsSubscription_NextMsg(natsMsg **nextMsg, natsSubscription *sub,
4940 int64_t timeout);
4941
4950 NATS_EXTERN natsStatus
4951 natsSubscription_Unsubscribe(natsSubscription *sub);
4952
4964 NATS_EXTERN natsStatus
4965 natsSubscription_AutoUnsubscribe(natsSubscription *sub, int max);
4966
4976 NATS_EXTERN natsStatus
4977 natsSubscription_QueuedMsgs(natsSubscription *sub, uint64_t *queuedMsgs);
4978
4987 NATS_EXTERN int64_t
4988 natsSubscription_GetID(natsSubscription* sub);
4989
5000 NATS_EXTERN const char*
5001 natsSubscription_GetSubject(natsSubscription* sub);
5002
5023 NATS_EXTERN natsStatus
5024 natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit);
5025
5045 NATS_EXTERN natsStatus
5046 natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit);
5047
5062 NATS_EXTERN natsStatus
5063 natsSubscription_GetPending(natsSubscription *sub, int *msgs, int *bytes);
5064
5073 NATS_EXTERN natsStatus
5074 natsSubscription_GetDelivered(natsSubscription *sub, int64_t *msgs);
5075
5091 NATS_EXTERN natsStatus
5092 natsSubscription_GetDropped(natsSubscription *sub, int64_t *msgs);
5093
5106 NATS_EXTERN natsStatus
5107 natsSubscription_GetMaxPending(natsSubscription *sub, int *msgs, int *bytes);
5108
5115 NATS_EXTERN natsStatus
5116 natsSubscription_ClearMaxPending(natsSubscription *sub);
5117
5144 NATS_EXTERN natsStatus
5145 natsSubscription_GetStats(natsSubscription *sub,
5146 int *pendingMsgs,
5147 int *pendingBytes,
5148 int *maxPendingMsgs,
5149 int *maxPendingBytes,
5150 int64_t *deliveredMsgs,
5151 int64_t *droppedMsgs);
5152
5161 NATS_EXTERN bool
5162 natsSubscription_IsValid(natsSubscription *sub);
5163
5181 NATS_EXTERN natsStatus
5182 natsSubscription_Drain(natsSubscription *sub);
5183
5234 NATS_EXTERN natsStatus
5235 natsSubscription_DrainTimeout(natsSubscription *sub, int64_t timeout);
5236
5259 NATS_EXTERN natsStatus
5260 natsSubscription_WaitForDrainCompletion(natsSubscription *sub, int64_t timeout);
5261
5287 NATS_EXTERN natsStatus
5288 natsSubscription_DrainCompletionStatus(natsSubscription *sub);
5289
5318 NATS_EXTERN natsStatus
5319 natsSubscription_SetOnCompleteCB(natsSubscription *sub, natsOnCompleteCB cb, void *closure);
5320
5328 NATS_EXTERN void
5329 natsSubscription_Destroy(natsSubscription *sub);
5330 // end of subGroup
5332
5333 #if defined(NATS_HAS_STREAMING)
5374 NATS_EXTERN natsStatus
5375 stanConnection_Connect(stanConnection **sc, const char *clusterID, const char *clientID,
5376 stanConnOptions *options);
5377
5400 NATS_EXTERN natsStatus
5401 stanConnection_GetNATSConnection(stanConnection *sc, natsConnection **nc);
5402
5427 NATS_EXTERN void
5428 stanConnection_ReleaseNATSConnection(stanConnection *sc);
5429
5440 NATS_EXTERN natsStatus
5441 stanConnection_Close(stanConnection *sc);
5442
5450 NATS_EXTERN natsStatus
5451 stanConnection_Destroy(stanConnection *sc);
5452 // end of stanConnMgtGroup
5454
5471 NATS_EXTERN natsStatus
5472 stanConnection_Publish(stanConnection *sc, const char *channel,
5473 const void *data, int dataLen);
5474
5498 NATS_EXTERN natsStatus
5499 stanConnection_PublishAsync(stanConnection *sc, const char *channel,
5500 const void *data, int dataLen,
5501 stanPubAckHandler ah, void *ahClosure);
5502 // end of stanConnPubGroup
5504
5527 NATS_EXTERN natsStatus
5528 stanConnection_Subscribe(stanSubscription **sub, stanConnection *sc,
5529 const char *channel, stanMsgHandler cb,
5530 void *cbClosure, stanSubOptions *options);
5531
5551 NATS_EXTERN natsStatus
5552 stanConnection_QueueSubscribe(stanSubscription **sub, stanConnection *sc,
5553 const char *channel, const char *queueGroup,
5554 stanMsgHandler cb, void *cbClosure, stanSubOptions *options);
5555 // end of stanConnSubGroup
5557 // end of stanConnGroup
5559
5588 NATS_EXTERN natsStatus
5589 stanSubscription_SetOnCompleteCB(stanSubscription *sub, natsOnCompleteCB cb, void *closure);
5590
5600 NATS_EXTERN natsStatus
5601 stanSubscription_AckMsg(stanSubscription *sub, stanMsg *msg);
5602
5622 NATS_EXTERN natsStatus
5623 stanSubscription_Unsubscribe(stanSubscription *sub);
5624
5635 NATS_EXTERN natsStatus
5636 stanSubscription_Close(stanSubscription *sub);
5637
5645 NATS_EXTERN void
5646 stanSubscription_Destroy(stanSubscription *sub);
5647 // end of stanSubGroup
5649 #endif
5650
5664 NATS_EXTERN natsStatus
5665 jsOptions_Init(jsOptions *opts);
5666
5681 NATS_EXTERN natsStatus
5682 natsConnection_JetStream(jsCtx **js, natsConnection *nc, jsOptions *opts);
5683
5690 NATS_EXTERN void
5691 jsCtx_Destroy(jsCtx *js);
5692
5706 NATS_EXTERN natsStatus
5707 jsStreamConfig_Init(jsStreamConfig *cfg);
5708
5715 NATS_EXTERN natsStatus
5716 jsPlacement_Init(jsPlacement *placement);
5717
5724 NATS_EXTERN natsStatus
5725 jsStreamSource_Init(jsStreamSource *source);
5726
5733 NATS_EXTERN natsStatus
5734 jsExternalStream_Init(jsExternalStream *external);
5735
5742 NATS_EXTERN natsStatus
5743 jsRePublish_Init(jsRePublish *rp);
5744
5764 NATS_EXTERN natsStatus
5765 js_AddStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
5766
5786 NATS_EXTERN natsStatus
5787 js_UpdateStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode);
5788
5811 NATS_EXTERN natsStatus
5812 js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
5813
5824 NATS_EXTERN natsStatus
5825 js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
5826
5844 NATS_EXTERN natsStatus
5845 js_GetMsg(natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
5846
5864 NATS_EXTERN natsStatus
5865 js_GetLastMsg(natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode);
5866
5874 NATS_EXTERN natsStatus
5875 jsDirectGetMsgOptions_Init(jsDirectGetMsgOptions *opts);
5876
5899 NATS_EXTERN natsStatus
5900 js_DirectGetMsg(natsMsg **msg, jsCtx *js, const char *stream, jsOptions *opts, jsDirectGetMsgOptions *dgOpts);
5901
5918 NATS_EXTERN natsStatus
5919 js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
5920
5935 NATS_EXTERN natsStatus
5936 js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
5937
5964 NATS_EXTERN natsStatus
5965 js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
5966
5973 NATS_EXTERN void
5974 jsStreamInfo_Destroy(jsStreamInfo *si);
5975
5990 NATS_EXTERN natsStatus
5991 js_Streams(jsStreamInfoList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
5992
6002 NATS_EXTERN void
6003 jsStreamInfoList_Destroy(jsStreamInfoList *list);
6004
6019 NATS_EXTERN natsStatus
6020 js_StreamNames(jsStreamNamesList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
6021
6031 NATS_EXTERN void
6032 jsStreamNamesList_Destroy(jsStreamNamesList *list);
6033
6042 NATS_EXTERN natsStatus
6043 jsConsumerConfig_Init(jsConsumerConfig *cc);
6044
6064 NATS_EXTERN natsStatus
6065 js_AddConsumer(jsConsumerInfo **ci, jsCtx *js,
6066 const char *stream, jsConsumerConfig *cfg,
6067 jsOptions *opts, jsErrCode *errCode);
6068
6088 NATS_EXTERN natsStatus
6089 js_UpdateConsumer(jsConsumerInfo **ci, jsCtx *js,
6090 const char *stream, jsConsumerConfig *cfg,
6091 jsOptions *opts, jsErrCode *errCode);
6092
6106 NATS_EXTERN natsStatus
6107 js_GetConsumerInfo(jsConsumerInfo **ci, jsCtx *js,
6108 const char *stream, const char *consumer,
6109 jsOptions *opts, jsErrCode *errCode);
6110
6122 NATS_EXTERN natsStatus
6123 js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer,
6124 jsOptions *opts, jsErrCode *errCode);
6125
6140 NATS_EXTERN natsStatus
6141 js_PauseConsumer(jsConsumerPauseResponse **new_cpr, jsCtx *js,
6142 const char *stream, const char *consumer,
6143 uint64_t pauseUntil, jsOptions *opts, jsErrCode *errCode);
6144
6151 NATS_EXTERN void
6152 jsConsumerPauseResponse_Destroy(jsConsumerPauseResponse *cpr);
6153
6160 NATS_EXTERN void
6161 jsConsumerInfo_Destroy(jsConsumerInfo *ci);
6162
6177 NATS_EXTERN natsStatus
6178 js_Consumers(jsConsumerInfoList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
6179
6189 NATS_EXTERN void
6190 jsConsumerInfoList_Destroy(jsConsumerInfoList *list);
6191
6206 NATS_EXTERN natsStatus
6207 js_ConsumerNames(jsConsumerNamesList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
6208
6218 NATS_EXTERN void
6219 jsConsumerNamesList_Destroy(jsConsumerNamesList *list);
6220
6235 NATS_EXTERN natsStatus
6236 js_GetAccountInfo(jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode);
6237
6244 NATS_EXTERN void
6245 jsAccountInfo_Destroy(jsAccountInfo *ai);
6246 // end of jsAssetsGroup
6248
6262 NATS_EXTERN natsStatus
6263 jsPubOptions_Init(jsPubOptions *opts);
6264
6280 NATS_EXTERN natsStatus
6281 js_Publish(jsPubAck **pubAck, jsCtx *js, const char *subj, const void *data, int dataLen,
6282 jsPubOptions *opts, jsErrCode *errCode);
6283
6303 NATS_EXTERN natsStatus
6304 js_PublishMsg(jsPubAck **pubAck, jsCtx *js, natsMsg *msg,
6305 jsPubOptions *opts, jsErrCode *errCode);
6306
6313 NATS_EXTERN void
6314 jsPubAck_Destroy(jsPubAck *pubAck);
6315
6326 NATS_EXTERN natsStatus
6327 js_PublishAsync(jsCtx *js, const char *subj, const void *data, int dataLen,
6328 jsPubOptions *opts);
6329
6353 NATS_EXTERN natsStatus
6354 js_PublishMsgAsync(jsCtx *js, natsMsg **msg, jsPubOptions *opts);
6355
6367 NATS_EXTERN natsStatus
6368 js_PublishAsyncComplete(jsCtx *js, jsPubOptions *opts);
6369
6418 NATS_EXTERN natsStatus
6419 js_PublishAsyncGetPendingList(natsMsgList *pending, jsCtx *js);
6420 // end of jsPubGroup
6422
6436 NATS_EXTERN natsStatus
6437 jsSubOptions_Init(jsSubOptions *opts);
6438
6484 NATS_EXTERN natsStatus
6485 js_Subscribe(natsSubscription **sub, jsCtx *js, const char *subject,
6486 natsMsgHandler cb, void* cbClosure,
6487 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6488
6506 NATS_EXTERN natsStatus
6507 js_SubscribeMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
6508 natsMsgHandler cb, void *cbClosure,
6509 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6510
6524 NATS_EXTERN natsStatus
6525 js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject,
6526 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6527
6543 NATS_EXTERN natsStatus
6544 js_SubscribeSyncMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
6545 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6546
6568 NATS_EXTERN natsStatus
6569 js_PullSubscribe(natsSubscription **sub, jsCtx *js, const char *subject, const char *durable,
6570 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
6571
6590 NATS_EXTERN natsStatus
6591 natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout,
6592 jsErrCode *errCode);
6593
6600 NATS_EXTERN natsStatus
6601 jsFetchRequest_Init(jsFetchRequest *request);
6602
6626 NATS_EXTERN natsStatus
6627 js_PullSubscribeAsync(natsSubscription **newsub, jsCtx *js, const char *subject, const char *durable,
6628 natsMsgHandler msgCB, void *msgCBClosure,
6629 jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode);
6630
6643 NATS_EXTERN natsStatus
6644 natsSubscription_FetchRequest(natsMsgList *list, natsSubscription *sub, jsFetchRequest *request);
6645
6656 NATS_EXTERN natsStatus
6657 natsSubscription_GetConsumerInfo(jsConsumerInfo **ci, natsSubscription *sub,
6658 jsOptions *opts, jsErrCode *errCode);
6659
6687 NATS_EXTERN natsStatus
6688 natsSubscription_GetSequenceMismatch(jsConsumerSequenceMismatch *csm, natsSubscription *sub);
6689 // end of jsSubGroup
6691
6712 NATS_EXTERN natsStatus
6713 natsMsg_GetMetaData(jsMsgMetaData **new_meta, natsMsg *msg);
6714
6721 NATS_EXTERN void
6722 jsMsgMetaData_Destroy(jsMsgMetaData *meta);
6723
6732 NATS_EXTERN natsStatus
6733 natsMsg_Ack(natsMsg *msg, jsOptions *opts);
6734
6746 NATS_EXTERN natsStatus
6747 natsMsg_AckSync(natsMsg *msg, jsOptions *opts, jsErrCode *errCode);
6748
6759 NATS_EXTERN natsStatus
6760 natsMsg_Nak(natsMsg *msg, jsOptions *opts);
6761
6774 NATS_EXTERN natsStatus
6775 natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts);
6776
6785 NATS_EXTERN natsStatus
6786 natsMsg_InProgress(natsMsg *msg, jsOptions *opts);
6787
6796 NATS_EXTERN natsStatus
6797 natsMsg_Term(natsMsg *msg, jsOptions *opts);
6798
6808 NATS_EXTERN uint64_t
6809 natsMsg_GetSequence(natsMsg *msg);
6810
6820 NATS_EXTERN int64_t
6821 natsMsg_GetTime(natsMsg *msg);
6822 // end of jsMsg
6824 // end of jsGroup
6826
6855 NATS_EXTERN natsStatus
6856 kvConfig_Init(kvConfig *cfg);
6857
6872 NATS_EXTERN natsStatus
6873 js_CreateKeyValue(kvStore **new_kv, jsCtx *js, kvConfig *cfg);
6874
6890 NATS_EXTERN natsStatus
6891 js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket);
6892
6902 NATS_EXTERN natsStatus
6903 js_DeleteKeyValue(jsCtx *js, const char *bucket);
6904
6912 NATS_EXTERN void
6913 kvStore_Destroy(kvStore *kv);
6914 // end of kvGroupMgt
6916
6933 NATS_EXTERN const char*
6934 kvEntry_Bucket(kvEntry *e);
6935
6942 NATS_EXTERN const char*
6943 kvEntry_Key(kvEntry *e);
6944
6951 NATS_EXTERN const void*
6952 kvEntry_Value(kvEntry *e);
6953
6960 NATS_EXTERN int
6961 kvEntry_ValueLen(kvEntry *e);
6962
6970 NATS_EXTERN const char*
6971 kvEntry_ValueString(kvEntry *e);
6972
6979 NATS_EXTERN uint64_t
6980 kvEntry_Revision(kvEntry *e);
6981
6988 NATS_EXTERN int64_t
6989 kvEntry_Created(kvEntry *e);
6990
7000 NATS_EXTERN uint64_t
7001 kvEntry_Delta(kvEntry *e);
7002
7011 NATS_EXTERN kvOperation
7012 kvEntry_Operation(kvEntry *e);
7013
7020 NATS_EXTERN void
7021 kvEntry_Destroy(kvEntry *e);
7022 // end of kvEntry
7024
7035 NATS_EXTERN natsStatus
7036 kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key);
7037
7050 NATS_EXTERN natsStatus
7051 kvStore_GetRevision(kvEntry **new_entry, kvStore *kv, const char *key, uint64_t revision);
7052
7063 NATS_EXTERN natsStatus
7064 kvStore_Put(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
7065
7079 NATS_EXTERN natsStatus
7080 kvStore_PutString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
7081
7092 NATS_EXTERN natsStatus
7093 kvStore_Create(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
7094
7108 NATS_EXTERN natsStatus
7109 kvStore_CreateString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
7110
7122 NATS_EXTERN natsStatus
7123 kvStore_Update(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last);
7124
7139 NATS_EXTERN natsStatus
7140 kvStore_UpdateString(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last);
7141
7149 NATS_EXTERN natsStatus
7150 kvStore_Delete(kvStore *kv, const char *key);
7151
7160 NATS_EXTERN natsStatus
7161 kvStore_Purge(kvStore *kv, const char *key, kvPurgeOptions *opts);
7162
7170 NATS_EXTERN natsStatus
7171 kvWatchOptions_Init(kvWatchOptions *opts);
7172
7180 NATS_EXTERN natsStatus
7181 kvPurgeOptions_Init(kvPurgeOptions *opts);
7182
7200 NATS_EXTERN natsStatus
7201 kvStore_PurgeDeletes(kvStore *kv, kvPurgeOptions *opts);
7202
7219 NATS_EXTERN natsStatus
7220 kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, kvWatchOptions *opts);
7221
7243 NATS_EXTERN natsStatus
7244 kvStore_WatchMulti(kvWatcher **new_watcher, kvStore *kv, const char **keys, int numKeys, kvWatchOptions *opts);
7245
7260 NATS_EXTERN natsStatus
7261 kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, kvWatchOptions *opts);
7262
7281 NATS_EXTERN natsStatus
7282 kvStore_Keys(kvKeysList *list, kvStore *kv, kvWatchOptions *opts);
7283
7307 NATS_EXTERN natsStatus
7308 kvStore_KeysWithFilters(kvKeysList *list, kvStore *kv, const char **filters, int numFilters, kvWatchOptions *opts);
7309
7321 NATS_EXTERN void
7322 kvKeysList_Destroy(kvKeysList *list);
7323
7346 NATS_EXTERN natsStatus
7347 kvStore_History(kvEntryList *list, kvStore *kv, const char *key, kvWatchOptions *opts);
7348
7360 NATS_EXTERN void
7361 kvEntryList_Destroy(kvEntryList *list);
7362
7372 NATS_EXTERN const char*
7373 kvStore_Bucket(kvStore *kv);
7374
7375 // PurgeDeletes
7376
7386 NATS_EXTERN natsStatus
7387 kvStore_Status(kvStatus **new_status, kvStore *kv);
7388
7414 NATS_EXTERN natsStatus
7415 kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout);
7416
7426 NATS_EXTERN natsStatus
7427 kvWatcher_Stop(kvWatcher *w);
7428
7435 NATS_EXTERN void
7436 kvWatcher_Destroy(kvWatcher *w);
7437 // end of kvWatcher
7439
7456 NATS_EXTERN const char*
7457 kvStatus_Bucket(kvStatus *sts);
7458
7465 NATS_EXTERN uint64_t
7466 kvStatus_Values(kvStatus *sts);
7467
7474 NATS_EXTERN int64_t
7475 kvStatus_History(kvStatus *sts);
7476
7483 NATS_EXTERN int64_t
7484 kvStatus_TTL(kvStatus *sts);
7485
7492 NATS_EXTERN int64_t
7493 kvStatus_Replicas(kvStatus *sts);
7494
7501 NATS_EXTERN uint64_t
7502 kvStatus_Bytes(kvStatus *sts);
7503
7510 NATS_EXTERN void
7511 kvStatus_Destroy(kvStatus *sts);
7512 // end of kvStatus
7514 // end of kvGroup
7516 // end of funcGroup
7518
7519 //
7520 // Microservices.
7521 //
7522
7568 typedef struct micro_client_s microClient;
7569
7573 typedef struct __for_forward_compatibility_only microClientConfig;
7574
7584 typedef struct micro_endpoint_s microEndpoint;
7585
7593 typedef struct micro_endpoint_config_s microEndpointConfig;
7594
7604 typedef struct micro_endpoint_info_s microEndpointInfo;
7605
7614 typedef struct micro_endpoint_stats_s microEndpointStats;
7615
7628 typedef struct micro_error_s microError;
7629
7637 typedef struct micro_group_s microGroup;
7638
7645 typedef struct micro_group_config_s microGroupConfig;
7646
7652 typedef struct micro_request_s microRequest;
7653
7665 typedef struct micro_service_s microService;
7666
7676 typedef struct micro_service_config_s microServiceConfig;
7677
7687 typedef struct micro_service_info_s microServiceInfo;
7688
7695 typedef struct micro_service_stats_s microServiceStats;
7696
7697
7698 extern NATS_EXTERN microError *micro_ErrorOutOfMemory;
7699 extern NATS_EXTERN microError *micro_ErrorInvalidArg;
7700 // end of microTypes
7702
7721 typedef microError *(*microRequestHandler)(microRequest *req);
7722
7745 typedef void (*microErrorHandler)(microService *m, microEndpoint *ep, natsStatus s);
7746
7758 typedef void (*microDoneHandler)(microService *m);
7759 // end of microCallbacks
7761
7772 struct micro_endpoint_config_s
7773 {
7779 const char *Name;
7780
7790 const char *Subject;
7791
7796 const char *QueueGroup;
7797
7802 bool NoQueueGroup;
7803
7808 natsMetadata Metadata;
7809
7813 microRequestHandler Handler;
7814
7819 void *State;
7820 };
7821
7825 struct micro_endpoint_info_s
7826 {
7830 const char *Name;
7831
7835 const char *Subject;
7836
7841 const char *QueueGroup;
7842
7847 natsMetadata Metadata;
7848 };
7849
7853 struct micro_endpoint_stats_s
7854 {
7855 const char *Name;
7856 const char *Subject;
7857
7862 const char *QueueGroup;
7863
7867 int64_t NumRequests;
7868
7873 int64_t NumErrors;
7874
7878 int64_t ProcessingTimeSeconds;
7879
7883 int64_t ProcessingTimeNanoseconds;
7884
7888 int64_t AverageProcessingTimeNanoseconds;
7889
7893 char LastErrorString[2048];
7894 };
7895
7899 struct micro_group_config_s
7900 {
7902 const char *Prefix;
7903
7905 const char *QueueGroup;
7906
7908 bool NoQueueGroup;
7909 };
7910
7917 struct micro_service_config_s
7918 {
7924 const char *Name;
7925
7929 const char *Version;
7930
7934 const char *Description;
7935
7940 const char *QueueGroup;
7941
7946 bool NoQueueGroup;
7947
7952 natsMetadata Metadata;
7953
7961 microEndpointConfig *Endpoint;
7962
7970 microRequestHandler StatsHandler;
7971
7979 microErrorHandler ErrHandler;
7980
7989 microDoneHandler DoneHandler;
7990
7998 void *State;
7999 };
8000
8006 struct micro_service_info_s
8007 {
8011 const char *Type;
8012
8016 const char *Name;
8017
8021 const char *Version;
8022
8026 const char *Description;
8027
8031 const char *Id;
8032
8036 natsMetadata Metadata;
8037
8041 microEndpointInfo *Endpoints;
8042
8046 int EndpointsLen;
8047 };
8048
8052 struct micro_service_stats_s
8053 {
8057 const char *Type;
8058
8062 const char *Name;
8063
8067 const char *Version;
8068
8072 const char *Id;
8073
8077 int64_t Started;
8078
8082 microEndpointStats *Endpoints;
8083
8087 int EndpointsLen;
8088 };
8089 // end of microStructs
8091
8103 #define MICRO_API_PREFIX "$SRV"
8104
8108 #define MICRO_INFO_RESPONSE_TYPE "io.nats.micro.v1.info_response"
8109
8113 #define MICRO_INFO_VERB "INFO"
8114
8118 #define MICRO_PING_RESPONSE_TYPE "io.nats.micro.v1.ping_response"
8119
8123 #define MICRO_PING_VERB "PING"
8124
8128 #define MICRO_STATS_RESPONSE_TYPE "io.nats.micro.v1.stats_response"
8129
8133 #define MICRO_STATS_VERB "STATS"
8134
8139 #define MICRO_STATUS_HDR "Nats-Status"
8140
8145 #define MICRO_ERROR_HDR "Nats-Service-Error"
8146
8151 #define MICRO_ERROR_CODE_HDR "Nats-Service-Error-Code"
8152 // end of microConstants
8154
8184 NATS_EXTERN microError *
8185 micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config);
8186
8200 NATS_EXTERN microError *
8201 microService_AddEndpoint(microService *m, microEndpointConfig *config);
8202
8217 NATS_EXTERN microError *
8218 microService_AddGroup(microGroup **new_group, microService *m, microGroupConfig *config);
8219
8231 NATS_EXTERN microError *
8232 microService_Destroy(microService *m);
8233
8242 NATS_EXTERN natsConnection *
8243 microService_GetConnection(microService *m);
8244
8257 NATS_EXTERN microError *
8258 microService_GetInfo(microServiceInfo **new_info, microService *m);
8259
8269 NATS_EXTERN void *
8270 microService_GetState(microService *m);
8271
8284 NATS_EXTERN microError *
8285 microService_GetStats(microServiceStats **new_stats, microService *m);
8286
8295 NATS_EXTERN bool
8296 microService_IsStopped(microService *m);
8297
8309 NATS_EXTERN microError *
8310 microService_Run(microService *m);
8311
8328 NATS_EXTERN microError *microService_Stop(microService *m);
8329 // end of microServiceFunctions
8331
8352 NATS_EXTERN microError *
8353 microGroup_AddGroup(microGroup **new_group, microGroup *parent, microGroupConfig *config);
8354
8368 NATS_EXTERN microError *
8369 microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config);
8370 // end of microGroupFunctions
8372
8392 NATS_EXTERN microError *
8393 microRequest_AddHeader(microRequest *req, const char *key, const char *value);
8394
8404 NATS_EXTERN microError *
8405 microRequest_DeleteHeader(microRequest *req, const char *key);
8406
8415 NATS_EXTERN natsConnection *
8416 microRequest_GetConnection(microRequest *req);
8417
8431 NATS_EXTERN const char *
8432 microRequest_GetData(microRequest *req);
8433
8442 NATS_EXTERN int
8443 microRequest_GetDataLength(microRequest *req);
8444
8454 NATS_EXTERN void *
8455 microRequest_GetEndpointState(microRequest *req);
8456
8473 NATS_EXTERN microError *
8474 microRequest_GetHeaderKeys(microRequest *req, const char ***keys, int *count);
8475
8487 NATS_EXTERN microError *
8488 microRequest_GetHeaderValue(microRequest *req, const char *key, const char **value);
8489
8505 NATS_EXTERN microError *
8506 microRequest_GetHeaderValues(microRequest *req, const char *key, const char ***values, int *count);
8507
8514 NATS_EXTERN natsMsg *
8515 microRequest_GetMsg(microRequest *req);
8516
8526 NATS_EXTERN const char *
8527 microRequest_GetReply(microRequest *req);
8528
8535 NATS_EXTERN microService *
8536 microRequest_GetService(microRequest *req);
8537
8546 NATS_EXTERN void *
8547 microRequest_GetServiceState(microRequest *req);
8548
8556 NATS_EXTERN const char *
8557 microRequest_GetSubject(microRequest *req);
8558
8568 NATS_EXTERN microError *
8569 microRequest_Respond(microRequest *req, const char *data, size_t len);
8570
8585 NATS_EXTERN microError *
8586 microRequest_RespondError(microRequest *req, microError *err);
8587
8631 NATS_EXTERN microError *
8632 microRequest_RespondCustom(microRequest *req, microError *err, const char *data, size_t len);
8633
8647 NATS_EXTERN microError *
8648 microRequest_SetHeader(microRequest *req, const char *key, const char *value);
8649 // end of microRequestFunctions
8651
8667 NATS_EXTERN microError *
8668 micro_Errorf(const char *format, ...);
8669
8681 NATS_EXTERN microError *
8682 micro_ErrorfCode(int code, const char *format, ...);
8683
8690 NATS_EXTERN microError *
8691 micro_ErrorFromStatus(natsStatus s);
8692
8699 NATS_EXTERN int
8700 microError_Code(microError *err);
8701
8706 NATS_EXTERN void
8707 microError_Destroy(microError *err);
8708
8709 #define microError_Ignore(__err) microError_Destroy(__err)
8710
8718 NATS_EXTERN natsStatus
8719 microError_Status(microError *err);
8720
8732 NATS_EXTERN const char *
8733 microError_String(microError *err, char *buf, size_t len);
8734
8748 NATS_EXTERN microError *
8749 microError_Wrapf(microError *err, const char *format, ...);
8750 // end of microErrorFunctions
8752
8767 NATS_EXTERN microError *
8768 micro_NewClient(microClient **new_client, natsConnection *nc, microClientConfig *cfg);
8769
8775 NATS_EXTERN void
8776 microClient_Destroy(microClient *client);
8777
8790 NATS_EXTERN microError *
8791 microClient_DoRequest(natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len);
8792 // end of microClientFunctions
8794
8806 NATS_EXTERN void
8807 microServiceInfo_Destroy(microServiceInfo *info);
8808
8814 NATS_EXTERN void
8815 microServiceStats_Destroy(microServiceStats *stats);
8816 // end of microCleanupFunctions
8818 // end of microFunctions
8820 // end of microGroup
8822
8859 #ifdef __cplusplus
8860 }
8861 #endif
8862
8863 #endif /* NATS_H_ */
natsOnCompleteCB
void(* natsOnCompleteCB)(void *closure)
Callback used to notify that an object lifecycle is complete.
Definition: nats.h:1723
natsEvLoop_Attach
natsStatus(* natsEvLoop_Attach)(void **userData, void *loop, natsConnection *nc, natsSock socket)
Attach this connection to the external event loop.
Definition: nats.h:1604
natsUserJWTHandler
natsStatus(* natsUserJWTHandler)(char **userJWT, char **customErrTxt, void *closure)
Callback used to fetch and return account signed user JWT.
Definition: nats.h:1667
natsEvLoop_WriteAddRemove
natsStatus(* natsEvLoop_WriteAddRemove)(void *userData, bool add)
Write event needs to be added or removed.
Definition: nats.h:1632
natsCustomReconnectDelayHandler
int64_t(* natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure)
Callback used to specify how long to wait between reconnects.
Definition: nats.h:1745
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:1824
natsTokenHandler
const char *(* natsTokenHandler)(void *closure)
Callback used to build a token on connections and reconnections.
Definition: nats.h:1713
jsPubAckErrHandler
void(* jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish errors from JetStream.
Definition: nats.h:1781
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:1587
natsEvLoop_Detach
natsStatus(* natsEvLoop_Detach)(void *userData)
Detach from the event loop.
Definition: nats.h:1643
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:1698
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:1856
natsConnectionHandler
void(* natsConnectionHandler)(natsConnection *nc, void *closure)
Callback used to notify the user of asynchronous connection events.
Definition: nats.h:1578
natsMsgHandler
void(* natsMsgHandler)(natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition: nats.h:1562
stanPubAckHandler
void(* stanPubAckHandler)(const char *guid, const char *error, void *closure)
Callback used to notify of an asynchronous publish result.
Definition: nats.h:1836
natsEvLoop_ReadAddRemove
natsStatus(* natsEvLoop_ReadAddRemove)(void *userData, bool add)
Read event needs to be added or removed.
Definition: nats.h:1619
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:1847
natsConnection_Buffered
NATS_EXTERN int natsConnection_Buffered(natsConnection *nc)
Returns the number of bytes to be sent to the server.
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_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_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_Reconnect
natsStatus natsConnection_Reconnect(natsConnection *nc)
Drops the current connection, reconnects including re-subscribing.
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_Revision
NATS_EXTERN uint64_t kvEntry_Revision(kvEntry *e)
Returns the unique sequence for this value.
kvEntry_Key
NATS_EXTERN const char * kvEntry_Key(kvEntry *e)
Returns the name of the key that was retrieved.
kvEntry_Created
NATS_EXTERN int64_t kvEntry_Created(kvEntry *e)
Returns the time (in UTC) the data was put in the bucket.
kvEntry_Bucket
NATS_EXTERN const char * kvEntry_Bucket(kvEntry *e)
Returns the name of the bucket the data was loaded from.
kvEntry_ValueString
NATS_EXTERN const char * kvEntry_ValueString(kvEntry *e)
Returns the value, as a string, for this key.
kvEntry_Value
NATS_EXTERN const void * kvEntry_Value(kvEntry *e)
Returns the value for this key.
kvEntry_Destroy
NATS_EXTERN void kvEntry_Destroy(kvEntry *e)
Destroys the KeyValue entry object.
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_Bucket
NATS_EXTERN const char * kvStore_Bucket(kvStore *kv)
Returns the bucket name of this KeyValue store object.
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_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_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_Bucket
NATS_EXTERN const char * kvStatus_Bucket(kvStatus *sts)
Returns the bucket name.
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_GetLastError
NATS_EXTERN const char * nats_GetLastError(natsStatus *status)
Returns the calling thread's last known error.
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
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_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_GetVersion
NATS_EXTERN const char * nats_GetVersion(void)
Returns the Library's version.
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:7745
microRequestHandler
microError *(* microRequestHandler)(microRequest *req)
Callback type for request processing.
Definition: nats.h:7721
microDoneHandler
void(* microDoneHandler)(microService *m)
Callback type for Done (service stopped) notifications.
Definition: nats.h:7758
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.
micro_ErrorFromStatus
NATS_EXTERN microError * micro_ErrorFromStatus(natsStatus s)
Wraps a NATS status into a microError, if not a NATS_OK.
microError_Status
NATS_EXTERN natsStatus microError_Status(microError *err)
Returns the NATS status associated with the error.
micro_Errorf
NATS_EXTERN microError * micro_Errorf(const char *format,...)
creates a new microError, with a printf-like formatted message.
microError_Wrapf
NATS_EXTERN microError * microError_Wrapf(microError *err, const char *format,...)
Wraps an exising microError with a higher printf-like formatted message.
microError_Code
NATS_EXTERN int microError_Code(microError *err)
returns the int code of the error.
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.
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_AddHeader
NATS_EXTERN microError * microRequest_AddHeader(microRequest *req, const char *key, const char *value)
Adds a header to the underlying NATS request message.
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_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_RespondError
NATS_EXTERN microError * microRequest_RespondError(microRequest *req, microError *err)
Respond to a request with a simple error.
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_GetReply
NATS_EXTERN const char * microRequest_GetReply(microRequest *req)
Returns the reply subject set in this message.
microRequest_GetDataLength
NATS_EXTERN int microRequest_GetDataLength(microRequest *req)
Returns the number of data bytes in the the request.
microRequest_GetData
NATS_EXTERN const char * microRequest_GetData(microRequest *req)
Returns the data in the the request, as a byte array.
microRequest_GetConnection
NATS_EXTERN natsConnection * microRequest_GetConnection(microRequest *req)
Returns the connection associated with the request.
microRequest_GetSubject
NATS_EXTERN const char * microRequest_GetSubject(microRequest *req)
Returns the subject of the request message.
microRequest_GetMsg
NATS_EXTERN natsMsg * microRequest_GetMsg(microRequest *req)
Get the NATS message underlying the request.
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_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_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_GetService
NATS_EXTERN microService * microRequest_GetService(microRequest *req)
Returns the pointer to the microservice associated with 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_DeleteHeader
NATS_EXTERN microError * microRequest_DeleteHeader(microRequest *req, const char *key)
Deletes a header from the underlying NATS request message.
microService_AddEndpoint
NATS_EXTERN microError * microService_AddEndpoint(microService *m, microEndpointConfig *config)
Adds an endpoint to a microservice and starts listening for messages.
microService_AddGroup
NATS_EXTERN microError * microService_AddGroup(microGroup **new_group, microService *m, microGroupConfig *config)
Adds an group (prefix) to a microservice.
microService_GetState
NATS_EXTERN void * microService_GetState(microService *m)
Returns the pointer to state data (closure). It is originally provided in microServiceConfig....
microService_GetConnection
NATS_EXTERN natsConnection * microService_GetConnection(microService *m)
Returns the connection associated with the service. If the service was successfully started,...
microService_Stop
NATS_EXTERN microError * microService_Stop(microService *m)
Stops a running microservice.
microService_Run
NATS_EXTERN microError * microService_Run(microService *m)
Waits for a microservice to stop.
microService_GetInfo
NATS_EXTERN microError * microService_GetInfo(microServiceInfo **new_info, microService *m)
Returns a microServiceInfo for a microservice.
micro_AddService
NATS_EXTERN microError * micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config)
Creates and starts a new microservice.
microService_IsStopped
NATS_EXTERN bool microService_IsStopped(microService *m)
Checks if the service is stopped.
microService_Destroy
NATS_EXTERN microError * microService_Destroy(microService *m)
Destroys a microservice, stopping it first if needed.
microService_GetStats
NATS_EXTERN microError * microService_GetStats(microServiceStats **new_stats, microService *m)
Returns run-time statistics for a microservice.
microClient
struct micro_client_s microClient
The Microservice client.
Definition: nats.h:7568
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:7637
microRequest
struct micro_request_s microRequest
a request received by a microservice endpoint.
Definition: nats.h:7652
microError
struct micro_error_s microError
the Microservice error object.
Definition: nats.h:7628
microClientConfig
struct __for_forward_compatibility_only microClientConfig
The Microservice configuration object. For forward compatibility only.
Definition: nats.h:7573
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:7584
microService
struct micro_service_s microService
the main object for a configured microservice.
Definition: nats.h:7665
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.
natsMsgHeader_Keys
NATS_EXTERN natsStatus natsMsgHeader_Keys(natsMsg *msg, const char ***keys, int *count)
Get all header keys.
natsMsg_GetData
NATS_EXTERN const char * natsMsg_GetData(const natsMsg *msg)
Returns the message payload.
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.
natsMsgHeader_Values
NATS_EXTERN natsStatus natsMsgHeader_Values(natsMsg *msg, const char *key, const char ***values, int *count)
Get all header values associated with key.
natsMsg_GetSubject
NATS_EXTERN const char * natsMsg_GetSubject(const natsMsg *msg)
Returns the subject set in this message.
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.
natsMsg_GetReply
NATS_EXTERN const char * natsMsg_GetReply(const natsMsg *msg)
Returns the reply set in this message.
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_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_GetSubject
NATS_EXTERN const char * natsSubscription_GetSubject(natsSubscription *sub)
Gets the subject name.
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_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.
kvEntryList
struct kvEntryList kvEntryList
A list of KeyValue store entries.
stanSubOptions
struct __stanSubOptions stanSubOptions
Way to configure a stanSubscription.
Definition: nats.h:1531
jsConsumerConfig
struct jsConsumerConfig jsConsumerConfig
kvStore
struct __kvStore kvStore
Definition: nats.h:1367
jsOptions
struct jsOptions jsOptions
jsStorageCompression
jsStorageCompression
Definition: nats.h:326
jsDeliverPolicy
jsDeliverPolicy
Definition: nats.h:335
stanConnOptions
struct __stanConnOptions stanConnOptions
Way to configure a stanConnection.
Definition: nats.h:1525
jsStorageType
jsStorageType
Definition: nats.h:316
jsTier
struct jsTier jsTier
jsStreamInfoList
struct jsStreamInfoList jsStreamInfoList
jsPeerInfo
struct jsPeerInfo jsPeerInfo
natsInbox
char natsInbox
Unique subject often used for point-to-point communication.
Definition: nats.h:187
jsStreamAlternate
struct jsStreamAlternate jsStreamAlternate
jsStreamInfo
struct jsStreamInfo jsStreamInfo
jsStreamConfig
struct jsStreamConfig jsStreamConfig
jsSequenceInfo
struct jsSequenceInfo jsSequenceInfo
jsStreamState
struct jsStreamState jsStreamState
stanMsg
struct __stanMsg stanMsg
The Streaming message.
Definition: nats.h:1519
jsConsumerInfo
struct jsConsumerInfo jsConsumerInfo
jsSequencePair
struct jsSequencePair jsSequencePair
natsMetadata
struct natsMetadata natsMetadata
A type to represent user-provided metadata, a list of k=v pairs.
jsRetentionPolicy
jsRetentionPolicy
Definition: nats.h:295
jsPlacement
struct jsPlacement jsPlacement
kvWatcher
struct __kvWatcher kvWatcher
Definition: nats.h:1382
jsStreamStateSubject
struct jsStreamStateSubject jsStreamStateSubject
natsStatistics
struct __natsStatistics natsStatistics
Statistics of a natsConnection.
Definition: nats.h:159
jsAccountInfo
struct jsAccountInfo jsAccountInfo
jsFetchNextHandler
bool(* jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure)
Callback used to customize flow control for js_PullSubscribeAsync.
Definition: nats.h:1240
kvConfig
struct kvConfig kvConfig
jsPubOptions
struct jsPubOptions jsPubOptions
jsDiscardPolicy
jsDiscardPolicy
Definition: nats.h:306
jsDirectGetMsgOptions
struct jsDirectGetMsgOptions jsDirectGetMsgOptions
jsReplayPolicy
jsReplayPolicy
Definition: nats.h:361
natsSubscription
struct __natsSubscription natsSubscription
Interest on a given subject.
Definition: nats.h:165
kvOperation
kvOperation
Definition: nats.h:1388
jsAckPolicy
jsAckPolicy
Definition: nats.h:349
kvPurgeOptions
struct kvPurgeOptions kvPurgeOptions
stanConnection
struct __stanConnection stanConnection
A connection to a NATS Streaming Server.
Definition: nats.h:1507
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:1228
jsAccountLimits
struct jsAccountLimits jsAccountLimits
jsCtx
struct __jsCtx jsCtx
Definition: nats.h:262
jsClusterInfo
struct jsClusterInfo jsClusterInfo
jsStreamSourceInfo
struct jsStreamSourceInfo jsStreamSourceInfo
kvKeysList
struct kvKeysList kvKeysList
A list of KeyValue store keys.
jsStreamSource
struct jsStreamSource jsStreamSource
jsRePublish
struct jsRePublish jsRePublish
natsOptions
struct __natsOptions natsOptions
Way to configure a natsConnection.
Definition: nats.h:178
jsSubjectTransformConfig
struct jsSubjectTransformConfig jsSubjectTransformConfig
kvWatchOptions
struct kvWatchOptions kvWatchOptions
jsSubOptions
struct jsSubOptions jsSubOptions
jsConsumerSequenceMismatch
struct jsConsumerSequenceMismatch jsConsumerSequenceMismatch
jsMsgMetaData
struct jsMsgMetaData jsMsgMetaData
jsConsumerNamesList
struct jsConsumerNamesList jsConsumerNamesList
jsAPIStats
struct jsAPIStats jsAPIStats
natsClientConfig
struct __natsClientConfig natsClientConfig
An initial configuration for NATS client. Provides control over the threading model,...
jsConsumerPauseResponse
struct jsConsumerPauseResponse jsConsumerPauseResponse
kvStatus
struct __kvStatus kvStatus
Definition: nats.h:1377
kvEntry
struct __kvEntry kvEntry
Definition: nats.h:1372
jsConsumerInfoList
struct jsConsumerInfoList jsConsumerInfoList
jsStreamConsumerLimits
struct jsStreamConsumerLimits jsStreamConsumerLimits
jsPubAckErr
struct jsPubAckErr jsPubAckErr
natsMsg
struct __natsMsg natsMsg
A structure holding a subject, optional reply and payload.
Definition: nats.h:172
stanSubscription
struct __stanSubscription stanSubscription
Interest on a given channel.
Definition: nats.h:1513
jsStreamStateSubjects
struct jsStreamStateSubjects jsStreamStateSubjects
jsExternalStream
struct jsExternalStream jsExternalStream
jsFetchRequest
struct jsFetchRequest jsFetchRequest
jsPubAck
struct jsPubAck jsPubAck
jsStreamNamesList
struct jsStreamNamesList jsStreamNamesList
jsLostStreamData
struct jsLostStreamData jsLostStreamData
natsConnection
struct __natsConnection natsConnection
A connection to a NATS Server.
Definition: nats.h:152
natsMsgList
struct natsMsgList natsMsgList
A list of NATS messages.
js_StorageCompressionNone
@ js_StorageCompressionNone
Specifies no compression. It's the default.
Definition: nats.h:327
js_StorageCompressionS2
@ js_StorageCompressionS2
Specifies S2.
Definition: nats.h:328
js_DeliverByStartSequence
@ js_DeliverByStartSequence
Starts from a given sequence.
Definition: nats.h:339
js_DeliverByStartTime
@ js_DeliverByStartTime
Starts from a given UTC time (number of nanoseconds since epoch)
Definition: nats.h:340
js_DeliverNew
@ js_DeliverNew
Starts with messages sent after the consumer is created.
Definition: nats.h:338
js_DeliverLastPerSubject
@ js_DeliverLastPerSubject
Starts with the last message for all subjects received.
Definition: nats.h:341
js_DeliverLast
@ js_DeliverLast
Starts with the last sequence received.
Definition: nats.h:337
js_DeliverAll
@ js_DeliverAll
Starts from the very beginning of a stream. This is the default.
Definition: nats.h:336
js_FileStorage
@ js_FileStorage
Specifies on disk storage. It's the default.
Definition: nats.h:317
js_MemoryStorage
@ js_MemoryStorage
Specifies in memory only.
Definition: nats.h:318
js_LimitsPolicy
@ js_LimitsPolicy
Specifies that messages are retained until any given limit is reached, which could be one of MaxMsgs,...
Definition: nats.h:296
js_InterestPolicy
@ js_InterestPolicy
Specifies that when all known observables have acknowledged a message it can be removed.
Definition: nats.h:297
js_WorkQueuePolicy
@ js_WorkQueuePolicy
Specifies that when the first worker or subscriber acknowledges the message it can be removed.
Definition: nats.h:298
js_DiscardNew
@ js_DiscardNew
Will fail to store new messages.
Definition: nats.h:308
js_DiscardOld
@ js_DiscardOld
Will remove older messages to return to the limits. This is the default.
Definition: nats.h:307
js_ReplayInstant
@ js_ReplayInstant
Replays messages as fast as possible.
Definition: nats.h:362
js_ReplayOriginal
@ js_ReplayOriginal
Maintains the same timing as the messages were received.
Definition: nats.h:363
kvOp_Unknown
@ kvOp_Unknown
Definition: nats.h:1389
kvOp_Delete
@ kvOp_Delete
Definition: nats.h:1391
kvOp_Put
@ kvOp_Put
Definition: nats.h:1390
kvOp_Purge
@ kvOp_Purge
Definition: nats.h:1392
js_AckExplicit
@ js_AckExplicit
Requires ack or nack for all messages.
Definition: nats.h:350
js_AckAll
@ js_AckAll
When acking a sequence number, this implicitly acks all sequences below this one as well.
Definition: nats.h:352
js_AckNone
@ js_AckNone
Requires no acks for delivered messages.
Definition: nats.h:351
NATS_EXTERN
#define NATS_EXTERN
Needed for shared library.
Definition: nats.h:49
natsSock
int natsSock
Definition: nats.h:50
status.h
jsErrCode
jsErrCode
Definition: status.h: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:196
__natsClientConfig::DefaultRepliesToThreadPool
bool DefaultRepliesToThreadPool
Definition: nats.h:206
__natsClientConfig::UseSeparatePoolForReplies
bool UseSeparatePoolForReplies
Definition: nats.h:207
__natsClientConfig::ReplyThreadPoolMax
int ReplyThreadPoolMax
Definition: nats.h:208
__natsClientConfig::ThreadPoolMax
int ThreadPoolMax
Definition: nats.h:203
__natsClientConfig::DefaultWriteDeadline
int64_t DefaultWriteDeadline
Definition: nats.h:197
__natsClientConfig::DefaultToThreadPool
bool DefaultToThreadPool
Definition: nats.h:202
__natsClientConfig::LockSpinCount
int64_t LockSpinCount
Definition: nats.h:199
jsAPIStats
Definition: nats.h:1075
jsAPIStats::Total
uint64_t Total
Definition: nats.h:1076
jsAPIStats::Errors
uint64_t Errors
Definition: nats.h:1077
jsAccountInfo
Definition: nats.h:1112
jsAccountInfo::Consumers
int64_t Consumers
Definition: nats.h:1116
jsAccountInfo::Streams
int64_t Streams
Definition: nats.h:1115
jsAccountInfo::TiersLen
int TiersLen
Definition: nats.h:1121
jsAccountInfo::Memory
uint64_t Memory
Definition: nats.h:1113
jsAccountInfo::API
jsAPIStats API
Definition: nats.h:1118
jsAccountInfo::Limits
jsAccountLimits Limits
Definition: nats.h:1119
jsAccountInfo::Tiers
jsTier ** Tiers
Definition: nats.h:1120
jsAccountInfo::Domain
char * Domain
Definition: nats.h:1117
jsAccountInfo::Store
uint64_t Store
Definition: nats.h:1114
jsAccountLimits
Definition: nats.h:1085
jsAccountLimits::MemoryMaxStreamBytes
int64_t MemoryMaxStreamBytes
Definition: nats.h:1091
jsAccountLimits::MaxStreams
int64_t MaxStreams
Definition: nats.h:1088
jsAccountLimits::MaxAckPending
int64_t MaxAckPending
Definition: nats.h:1090
jsAccountLimits::MaxConsumers
int64_t MaxConsumers
Definition: nats.h:1089
jsAccountLimits::MaxStore
int64_t MaxStore
Definition: nats.h:1087
jsAccountLimits::MaxMemory
int64_t MaxMemory
Definition: nats.h:1086
jsAccountLimits::MaxBytesRequired
bool MaxBytesRequired
Definition: nats.h:1093
jsAccountLimits::StoreMaxStreamBytes
int64_t StoreMaxStreamBytes
Definition: nats.h:1092
jsClusterInfo
Definition: nats.h:708
jsClusterInfo::ReplicasLen
int ReplicasLen
Definition: nats.h:712
jsClusterInfo::Name
char * Name
Definition: nats.h:709
jsClusterInfo::Replicas
jsPeerInfo ** Replicas
Definition: nats.h:711
jsClusterInfo::Leader
char * Leader
Definition: nats.h:710
jsConsumerConfig
Definition: nats.h:834
jsConsumerConfig::MemoryStorage
bool MemoryStorage
Definition: nats.h:871
jsConsumerConfig::Name
const char * Name
Definition: nats.h:835
jsConsumerConfig::FilterSubjectsLen
int FilterSubjectsLen
Definition: nats.h:876
jsConsumerConfig::OptStartSeq
uint64_t OptStartSeq
Definition: nats.h:839
jsConsumerConfig::HeadersOnly
bool HeadersOnly
Definition: nats.h:854
jsConsumerConfig::RateLimit
uint64_t RateLimit
Definition: nats.h:848
jsConsumerConfig::DeliverPolicy
jsDeliverPolicy DeliverPolicy
Definition: nats.h:838
jsConsumerConfig::Description
const char * Description
Definition: nats.h:837
jsConsumerConfig::Durable
const char * Durable
Definition: nats.h:836
jsConsumerConfig::SampleFrequency
const char * SampleFrequency
Definition: nats.h:849
jsConsumerConfig::FlowControl
bool FlowControl
Definition: nats.h:852
jsConsumerConfig::MaxRequestBatch
int64_t MaxRequestBatch
Maximum Pull Consumer request batch size.
Definition: nats.h:857
jsConsumerConfig::AckWait
int64_t AckWait
Definition: nats.h:842
jsConsumerConfig::MaxRequestMaxBytes
int64_t MaxRequestMaxBytes
Maximum Pull Consumer request maximum bytes.
Definition: nats.h:859
jsConsumerConfig::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:840
jsConsumerConfig::MaxWaiting
int64_t MaxWaiting
Definition: nats.h:850
jsConsumerConfig::AckPolicy
jsAckPolicy AckPolicy
Definition: nats.h:841
jsConsumerConfig::Metadata
natsMetadata Metadata
User-provided metadata for the consumer, encoded as an array of {"key", "value",.....
Definition: nats.h:877
jsConsumerConfig::DeliverSubject
const char * DeliverSubject
Definition: nats.h:862
jsConsumerConfig::BackOff
int64_t * BackOff
Redelivery durations expressed in nanoseconds.
Definition: nats.h:844
jsConsumerConfig::MaxRequestExpires
int64_t MaxRequestExpires
Maximum Pull Consumer request expiration, expressed in number of nanoseconds.
Definition: nats.h:858
jsConsumerConfig::Heartbeat
int64_t Heartbeat
Heartbeat interval expressed in number of nanoseconds.
Definition: nats.h:853
jsConsumerConfig::PauseUntil
int64_t PauseUntil
Suspends the consumer until this deadline, represented as number of nanoseconds since epoch.
Definition: nats.h:881
jsConsumerConfig::Replicas
int64_t Replicas
Definition: nats.h:869
jsConsumerConfig::BackOffLen
int BackOffLen
Definition: nats.h:845
jsConsumerConfig::MaxDeliver
int64_t MaxDeliver
Definition: nats.h:843
jsConsumerConfig::FilterSubjects
const char ** FilterSubjects
Multiple filter subjects.
Definition: nats.h:875
jsConsumerConfig::ReplayPolicy
jsReplayPolicy ReplayPolicy
Definition: nats.h:847
jsConsumerConfig::DeliverGroup
const char * DeliverGroup
Definition: nats.h:863
jsConsumerConfig::MaxAckPending
int64_t MaxAckPending
Definition: nats.h:851
jsConsumerConfig::FilterSubject
const char * FilterSubject
Definition: nats.h:846
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:866
jsConsumerInfo
Definition: nats.h:1014
jsConsumerInfo::Paused
bool Paused
Definition: nats.h:1027
jsConsumerInfo::Delivered
jsSequenceInfo Delivered
Definition: nats.h:1019
jsConsumerInfo::Config
jsConsumerConfig * Config
Definition: nats.h:1018
jsConsumerInfo::PushBound
bool PushBound
Definition: nats.h:1026
jsConsumerInfo::NumWaiting
int64_t NumWaiting
Definition: nats.h:1023
jsConsumerInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:1017
jsConsumerInfo::Cluster
jsClusterInfo * Cluster
Definition: nats.h:1025
jsConsumerInfo::PauseRemaining
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition: nats.h:1028
jsConsumerInfo::NumAckPending
int64_t NumAckPending
Definition: nats.h:1021
jsConsumerInfo::Stream
char * Stream
Definition: nats.h:1015
jsConsumerInfo::NumRedelivered
int64_t NumRedelivered
Definition: nats.h:1022
jsConsumerInfo::Name
char * Name
Definition: nats.h:1016
jsConsumerInfo::AckFloor
jsSequenceInfo AckFloor
Definition: nats.h:1020
jsConsumerInfo::NumPending
uint64_t NumPending
Definition: nats.h:1024
jsConsumerInfoList
Definition: nats.h:1039
jsConsumerInfoList::List
jsConsumerInfo ** List
Definition: nats.h:1040
jsConsumerInfoList::Count
int Count
Definition: nats.h:1041
jsConsumerNamesList
Definition: nats.h:1053
jsConsumerNamesList::Count
int Count
Definition: nats.h:1055
jsConsumerNamesList::List
char ** List
Definition: nats.h:1054
jsConsumerPauseResponse
Definition: nats.h:1065
jsConsumerPauseResponse::PauseRemaining
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition: nats.h:1068
jsConsumerPauseResponse::Paused
bool Paused
Definition: nats.h:1066
jsConsumerPauseResponse::PauseUntil
int64_t PauseUntil
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:1067
jsConsumerSequenceMismatch
Definition: nats.h:902
jsConsumerSequenceMismatch::Stream
uint64_t Stream
This is the stream sequence that the application should resume from.
Definition: nats.h:903
jsConsumerSequenceMismatch::ConsumerServer
uint64_t ConsumerServer
This is the consumer sequence last sent by the server.
Definition: nats.h:905
jsConsumerSequenceMismatch::ConsumerClient
uint64_t ConsumerClient
This is the consumer sequence that was last received by the library.
Definition: nats.h:904
jsDirectGetMsgOptions
Definition: nats.h:1185
jsDirectGetMsgOptions::NextBySubject
const char * NextBySubject
Get the next message (based on sequence) for that subject.
Definition: nats.h:1187
jsDirectGetMsgOptions::Sequence
uint64_t Sequence
Get the message at this sequence.
Definition: nats.h:1186
jsDirectGetMsgOptions::LastBySubject
const char * LastBySubject
Get the last message on that subject.
Definition: nats.h:1188
jsExternalStream
Definition: nats.h:397
jsExternalStream::DeliverPrefix
const char * DeliverPrefix
Definition: nats.h:399
jsExternalStream::APIPrefix
const char * APIPrefix
Definition: nats.h:398
jsFetchRequest
Definition: nats.h:1198
jsFetchRequest::MaxBytes
int64_t MaxBytes
Maximum bytes for the request (request complete based on whichever Batch or MaxBytes comes first)
Definition: nats.h:1201
jsFetchRequest::Batch
int Batch
Maximum number of messages to be received (see MaxBytes)
Definition: nats.h:1200
jsFetchRequest::Expires
int64_t Expires
Expiration of the request, expressed in nanoseconds.
Definition: nats.h:1199
jsFetchRequest::NoWait
bool NoWait
Will not wait if the request cannot be completed.
Definition: nats.h:1202
jsFetchRequest::Heartbeat
int64_t Heartbeat
Have server sends heartbeats to help detect communication failures.
Definition: nats.h:1203
jsLostStreamData
Definition: nats.h:610
jsLostStreamData::Msgs
uint64_t * Msgs
Definition: nats.h:611
jsLostStreamData::Bytes
uint64_t Bytes
Definition: nats.h:613
jsLostStreamData::MsgsLen
int MsgsLen
Definition: nats.h:612
jsMsgMetaData
Definition: nats.h:1133
jsMsgMetaData::NumPending
uint64_t NumPending
Definition: nats.h:1136
jsMsgMetaData::Sequence
jsSequencePair Sequence
Definition: nats.h:1134
jsMsgMetaData::Stream
char * Stream
Definition: nats.h:1138
jsMsgMetaData::Domain
char * Domain
Definition: nats.h:1140
jsMsgMetaData::Consumer
char * Consumer
Definition: nats.h:1139
jsMsgMetaData::NumDelivered
uint64_t NumDelivered
Definition: nats.h:1135
jsMsgMetaData::Timestamp
int64_t Timestamp
Definition: nats.h:1137
jsOptions::jsOptionsPublishAsync
Definition: nats.h:1254
jsOptions::jsOptionsPublishAsync::ErrHandler
jsPubAckErrHandler ErrHandler
Callback invoked when error encountered publishing a given message.
Definition: nats.h:1269
jsOptions::jsOptionsPublishAsync::AckHandler
jsPubAckHandler AckHandler
Callback invoked for each asynchronous published message.
Definition: nats.h:1262
jsOptions::jsOptionsPublishAsync::AckHandlerClosure
void * AckHandlerClosure
Closure (or user data) passed to jsPubAckHandler callback.
Definition: nats.h:1263
jsOptions::jsOptionsPublishAsync::ErrHandlerClosure
void * ErrHandlerClosure
Closure (or user data) passed to jsPubAckErrHandler callback.
Definition: nats.h:1270
jsOptions::jsOptionsPublishAsync::StallWait
int64_t StallWait
Amount of time (in milliseconds) to wait in a PublishAsync call when there is MaxPending inflight mes...
Definition: nats.h:1272
jsOptions::jsOptionsPublishAsync::MaxPending
int64_t MaxPending
Maximum outstanding asynchronous publishes that can be inflight at one time.
Definition: nats.h:1255
jsOptions::jsOptionsPullSubscribeAsync
Definition: nats.h:1277
jsOptions::jsOptionsPullSubscribeAsync::MaxBytes
int64_t MaxBytes
Auto-unsubscribe after receiving this many bytes.
Definition: nats.h:1280
jsOptions::jsOptionsPullSubscribeAsync::NoWait
bool NoWait
If NoWait is set, the subscription will receive the messages already stored on the server subject to ...
Definition: nats.h:1289
jsOptions::jsOptionsPullSubscribeAsync::Heartbeat
int64_t Heartbeat
Have server sends heartbeats at this interval (in milliseconds) to help detect communication failures...
Definition: nats.h:1299
jsOptions::jsOptionsPullSubscribeAsync::MaxMessages
int MaxMessages
Auto-unsubscribed after receiving this many messages.
Definition: nats.h:1279
jsOptions::jsOptionsPullSubscribeAsync::FetchSize
int FetchSize
When using the automatic Fetch flow control (default NextHandler), this is the number of messages to ...
Definition: nats.h:1304
jsOptions::jsOptionsPullSubscribeAsync::NextHandler
jsFetchNextHandler NextHandler
If set, switches to manual fetch flow control.
Definition: nats.h:1319
jsOptions::jsOptionsPullSubscribeAsync::NextHandlerClosure
void * NextHandlerClosure
Definition: nats.h:1320
jsOptions::jsOptionsPullSubscribeAsync::CompleteHandler
jsFetchCompleteHandler CompleteHandler
Fetch complete handler that receives the exit status code, the subscription's Complete handler is als...
Definition: nats.h:1294
jsOptions::jsOptionsPullSubscribeAsync::Timeout
int64_t Timeout
Auto-unsubsribe after this many milliseconds.
Definition: nats.h:1278
jsOptions::jsOptionsPullSubscribeAsync::CompleteHandlerClosure
void * CompleteHandlerClosure
Definition: nats.h:1295
jsOptions::jsOptionsPullSubscribeAsync::KeepAhead
int KeepAhead
When using the automatic Fetch flow control (default NextHandler), initiate the next fetch request (t...
Definition: nats.h:1312
jsOptions::jsOptionsStream::jsOptionsStreamInfo
Definition: nats.h:1354
jsOptions::jsOptionsStream::jsOptionsStreamInfo::DeletedDetails
bool DeletedDetails
Get the list of deleted message sequences.
Definition: nats.h:1355
jsOptions::jsOptionsStream::jsOptionsStreamInfo::SubjectsFilter
const char * SubjectsFilter
Get the list of subjects in this stream.
Definition: nats.h:1356
jsOptions::jsOptionsStream::jsOptionsStreamPurge
Definition: nats.h:1343
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Sequence
uint64_t Sequence
Purge up to but not including sequence.
Definition: nats.h:1345
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Keep
uint64_t Keep
Number of messages to keep.
Definition: nats.h:1346
jsOptions::jsOptionsStream::jsOptionsStreamPurge::Subject
const char * Subject
This is the subject to match against messages for the purge command.
Definition: nats.h:1344
jsOptions::jsOptionsStream
Definition: nats.h:1332
jsOptions::jsOptionsStream::Info
struct jsOptions::jsOptionsStream::jsOptionsStreamInfo Info
Optional stream information retrieval options.
jsOptions::jsOptionsStream::Purge
struct jsOptions::jsOptionsStream::jsOptionsStreamPurge Purge
Optional stream purge options.
jsOptions
Definition: nats.h:1248
jsOptions::PullSubscribeAsync
struct jsOptions::jsOptionsPullSubscribeAsync PullSubscribeAsync
extra options for js_PullSubscribeAsync
jsOptions::PublishAsync
struct jsOptions::jsOptionsPublishAsync PublishAsync
extra options for js_PublishAsync
jsOptions::Wait
int64_t Wait
Amount of time (in milliseconds) to wait for various JetStream API requests, default is 5000 ms (5 se...
Definition: nats.h:1251
jsOptions::Prefix
const char * Prefix
JetStream prefix, default is "$JS.API".
Definition: nats.h:1249
jsOptions::Domain
const char * Domain
Domain changes the domain part of JetSteam API prefix.
Definition: nats.h:1250
jsOptions::Stream
struct jsOptions::jsOptionsStream Stream
Optional stream options.
jsPeerInfo
Definition: nats.h:694
jsPeerInfo::Offline
bool Offline
Definition: nats.h:697
jsPeerInfo::Lag
uint64_t Lag
Definition: nats.h:699
jsPeerInfo::Active
int64_t Active
Definition: nats.h:698
jsPeerInfo::Name
char * Name
Definition: nats.h:695
jsPeerInfo::Current
bool Current
Definition: nats.h:696
jsPlacement
Definition: nats.h:380
jsPlacement::TagsLen
int TagsLen
Definition: nats.h:383
jsPlacement::Cluster
const char * Cluster
Definition: nats.h:381
jsPlacement::Tags
const char ** Tags
Definition: nats.h:382
jsPubAckErr
Definition: nats.h:1161
jsPubAckErr::Msg
natsMsg * Msg
Definition: nats.h:1162
jsPubAckErr::Err
natsStatus Err
Definition: nats.h:1163
jsPubAckErr::ErrCode
jsErrCode ErrCode
Definition: nats.h:1164
jsPubAckErr::ErrText
const char * ErrText
Definition: nats.h:1165
jsPubAck
Definition: nats.h:1148
jsPubAck::Sequence
uint64_t Sequence
Definition: nats.h:1150
jsPubAck::Duplicate
bool Duplicate
Definition: nats.h:1152
jsPubAck::Domain
char * Domain
Definition: nats.h:1151
jsPubAck::Stream
char * Stream
Definition: nats.h:1149
jsPubOptions
Definition: nats.h:280
jsPubOptions::ExpectLastMsgId
const char * ExpectLastMsgId
Expected last message ID in the stream.
Definition: nats.h:284
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:281
jsPubOptions::ExpectLastSeq
uint64_t ExpectLastSeq
Expected last message sequence in the stream.
Definition: nats.h:285
jsPubOptions::ExpectNoMessage
bool ExpectNoMessage
Expected no message (that is, sequence == 0) for the subject in the stream.
Definition: nats.h:287
jsPubOptions::ExpectStream
const char * ExpectStream
Expected stream to respond from the publish call.
Definition: nats.h:283
jsPubOptions::MsgId
const char * MsgId
Message ID used for de-duplication.
Definition: nats.h:282
jsPubOptions::ExpectLastSubjectSeq
uint64_t ExpectLastSubjectSeq
Expected last message sequence for the subject in the stream.
Definition: nats.h:286
jsRePublish
Definition: nats.h:433
jsRePublish::HeadersOnly
bool HeadersOnly
Definition: nats.h:436
jsRePublish::Source
const char * Source
Definition: nats.h:434
jsRePublish::Destination
const char * Destination
Definition: nats.h:435
jsSequenceInfo
Definition: nats.h:1000
jsSequenceInfo::Last
int64_t Last
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:1003
jsSequenceInfo::Stream
uint64_t Stream
Definition: nats.h:1002
jsSequenceInfo::Consumer
uint64_t Consumer
Definition: nats.h:1001
jsSequencePair
Definition: nats.h:990
jsSequencePair::Consumer
uint64_t Consumer
Definition: nats.h:991
jsSequencePair::Stream
uint64_t Stream
Definition: nats.h:992
jsStreamAlternate
Definition: nats.h:735
jsStreamAlternate::Name
const char * Name
Definition: nats.h:736
jsStreamAlternate::Cluster
const char * Cluster
Definition: nats.h:738
jsStreamAlternate::Domain
const char * Domain
Definition: nats.h:737
jsStreamConfig
Definition: nats.h:539
jsStreamConfig::Discard
jsDiscardPolicy Discard
Definition: nats.h:551
jsStreamConfig::Subjects
const char ** Subjects
Definition: nats.h:542
jsStreamConfig::SubjectTransform
jsSubjectTransformConfig SubjectTransform
Applies a subject transform (to matching messages) before doing anything else when a new message is r...
Definition: nats.h:599
jsStreamConfig::AllowDirect
bool AllowDirect
Allow higher performance, direct access to get individual messages. E.g. KeyValue.
Definition: nats.h:575
jsStreamConfig::SourcesLen
int SourcesLen
Definition: nats.h:560
jsStreamConfig::DiscardNewPerSubject
bool DiscardNewPerSubject
Allow KV like semantics to also discard new on a per subject basis.
Definition: nats.h:583
jsStreamConfig::Compression
jsStorageCompression Compression
js_StorageCompressionNone (default) or js_StorageCompressionS2.
Definition: nats.h:592
jsStreamConfig::Description
const char * Description
Definition: nats.h:541
jsStreamConfig::Template
const char * Template
Definition: nats.h:555
jsStreamConfig::DenyPurge
bool DenyPurge
Restrict the ability to purge messages.
Definition: nats.h:563
jsStreamConfig::Storage
jsStorageType Storage
Definition: nats.h:552
jsStreamConfig::ConsumerLimits
jsStreamConsumerLimits ConsumerLimits
Sets the limits on certain options on all consumers of the stream.
Definition: nats.h:603
jsStreamConfig::Retention
jsRetentionPolicy Retention
Definition: nats.h:544
jsStreamConfig::MaxMsgs
int64_t MaxMsgs
Definition: nats.h:546
jsStreamConfig::MaxConsumers
int64_t MaxConsumers
Definition: nats.h:545
jsStreamConfig::Metadata
natsMetadata Metadata
A user-provided array of key/value pairs, encoded as a string array [n1, v1, n2, v2,...
Definition: nats.h:588
jsStreamConfig::FirstSeq
uint64_t FirstSeq
the starting sequence number for the stream.
Definition: nats.h:595
jsStreamConfig::Name
const char * Name
Definition: nats.h:540
jsStreamConfig::NoAck
bool NoAck
Definition: nats.h:554
jsStreamConfig::Sources
jsStreamSource ** Sources
Definition: nats.h:559
jsStreamConfig::MaxMsgSize
int32_t MaxMsgSize
Definition: nats.h:550
jsStreamConfig::RePublish
jsRePublish * RePublish
Allow republish of the message after being sequenced and stored.
Definition: nats.h:571
jsStreamConfig::MirrorDirect
bool MirrorDirect
Allow higher performance and unified direct access for mirrors as well.
Definition: nats.h:579
jsStreamConfig::Duplicates
int64_t Duplicates
Definition: nats.h:556
jsStreamConfig::MaxMsgsPerSubject
int64_t MaxMsgsPerSubject
Definition: nats.h:549
jsStreamConfig::MaxAge
int64_t MaxAge
Definition: nats.h:548
jsStreamConfig::SubjectsLen
int SubjectsLen
Definition: nats.h:543
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:567
jsStreamConfig::Mirror
jsStreamSource * Mirror
Definition: nats.h:558
jsStreamConfig::Placement
jsPlacement * Placement
Definition: nats.h:557
jsStreamConfig::MaxBytes
int64_t MaxBytes
Definition: nats.h:547
jsStreamConfig::Replicas
int64_t Replicas
Definition: nats.h:553
jsStreamConfig::Sealed
bool Sealed
Seal a stream so no messages can get our or in.
Definition: nats.h:561
jsStreamConfig::DenyDelete
bool DenyDelete
Restrict the ability to delete messages.
Definition: nats.h:562
jsStreamConsumerLimits
Definition: nats.h:455
jsStreamConsumerLimits::MaxAckPending
int MaxAckPending
Definition: nats.h:457
jsStreamConsumerLimits::InactiveThreshold
int64_t InactiveThreshold
Definition: nats.h:456
jsStreamInfo
Definition: nats.h:749
jsStreamInfo::Sources
jsStreamSourceInfo ** Sources
Definition: nats.h:755
jsStreamInfo::Created
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:751
jsStreamInfo::Alternates
jsStreamAlternate ** Alternates
Definition: nats.h:757
jsStreamInfo::State
jsStreamState State
Definition: nats.h:752
jsStreamInfo::Cluster
jsClusterInfo * Cluster
Definition: nats.h:753
jsStreamInfo::Mirror
jsStreamSourceInfo * Mirror
Definition: nats.h:754
jsStreamInfo::AlternatesLen
int AlternatesLen
Definition: nats.h:758
jsStreamInfo::Config
jsStreamConfig * Config
Definition: nats.h:750
jsStreamInfo::SourcesLen
int SourcesLen
Definition: nats.h:756
jsStreamInfoList
Definition: nats.h:770
jsStreamInfoList::List
jsStreamInfo ** List
Definition: nats.h:771
jsStreamInfoList::Count
int Count
Definition: nats.h:772
jsStreamNamesList
Definition: nats.h:784
jsStreamNamesList::List
char ** List
Definition: nats.h:785
jsStreamNamesList::Count
int Count
Definition: nats.h:786
jsStreamSource
Definition: nats.h:416
jsStreamSource::External
jsExternalStream * External
Definition: nats.h:421
jsStreamSource::OptStartTime
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:419
jsStreamSource::Name
const char * Name
Definition: nats.h:417
jsStreamSource::Domain
const char * Domain
Definition: nats.h:425
jsStreamSource::OptStartSeq
uint64_t OptStartSeq
Definition: nats.h:418
jsStreamSource::FilterSubject
const char * FilterSubject
Definition: nats.h:420
jsStreamSourceInfo
Definition: nats.h:720
jsStreamSourceInfo::FilterSubject
const char * FilterSubject
Definition: nats.h:725
jsStreamSourceInfo::Active
int64_t Active
Definition: nats.h:724
jsStreamSourceInfo::SubjectTransformsLen
int SubjectTransformsLen
Definition: nats.h:727
jsStreamSourceInfo::Name
char * Name
Definition: nats.h:721
jsStreamSourceInfo::External
jsExternalStream * External
Definition: nats.h:722
jsStreamSourceInfo::Lag
uint64_t Lag
Definition: nats.h:723
jsStreamSourceInfo::SubjectTransforms
jsSubjectTransformConfig * SubjectTransforms
Definition: nats.h:726
jsStreamState
Definition: nats.h:672
jsStreamState::Lost
jsLostStreamData * Lost
Definition: nats.h:684
jsStreamState::LastSeq
uint64_t LastSeq
Definition: nats.h:677
jsStreamState::Consumers
int64_t Consumers
Definition: nats.h:685
jsStreamState::DeletedLen
int DeletedLen
Definition: nats.h:683
jsStreamState::Msgs
uint64_t Msgs
Definition: nats.h:673
jsStreamState::Subjects
jsStreamStateSubjects * Subjects
Definition: nats.h:680
jsStreamState::FirstSeq
uint64_t FirstSeq
Definition: nats.h:675
jsStreamState::LastTime
int64_t LastTime
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:678
jsStreamState::NumSubjects
int64_t NumSubjects
Definition: nats.h:679
jsStreamState::Deleted
uint64_t * Deleted
Definition: nats.h:682
jsStreamState::NumDeleted
uint64_t NumDeleted
Definition: nats.h:681
jsStreamState::Bytes
uint64_t Bytes
Definition: nats.h:674
jsStreamState::FirstTime
int64_t FirstTime
UTC time expressed as number of nanoseconds since epoch.
Definition: nats.h:676
jsStreamStateSubject
Definition: nats.h:623
jsStreamStateSubject::Msgs
uint64_t Msgs
Definition: nats.h:625
jsStreamStateSubject::Subject
const char * Subject
Definition: nats.h:624
jsStreamStateSubjects
Definition: nats.h:659
jsStreamStateSubjects::Count
int Count
Definition: nats.h:661
jsStreamStateSubjects::List
jsStreamStateSubject * List
Definition: nats.h:660
jsSubOptions
Definition: nats.h:925
jsSubOptions::ManualAck
bool ManualAck
If true, the user will have to acknowledge the messages.
Definition: nats.h:970
jsSubOptions::Consumer
const char * Consumer
If specified, the subscription will be bound to an existing consumer from the Stream without attempti...
Definition: nats.h:942
jsSubOptions::Stream
const char * Stream
If specified, the consumer will be bound to this stream name.
Definition: nats.h:932
jsSubOptions::Ordered
bool Ordered
If true, this will be an ordered consumer.
Definition: nats.h:982
jsSubOptions::Queue
const char * Queue
Queue name for queue subscriptions.
Definition: nats.h:957
jsSubOptions::Config
jsConsumerConfig Config
Consumer configuration.
Definition: nats.h:975
jsSubjectTransformConfig
Definition: nats.h:445
jsSubjectTransformConfig::Destination
const char * Destination
Definition: nats.h:447
jsSubjectTransformConfig::Source
const char * Source
Definition: nats.h:446
jsTier
Definition: nats.h:1098
jsTier::Name
const char * Name
Definition: nats.h:1099
jsTier::Streams
int64_t Streams
Definition: nats.h:1102
jsTier::Store
uint64_t Store
Definition: nats.h:1101
jsTier::Consumers
int64_t Consumers
Definition: nats.h:1103
jsTier::Memory
uint64_t Memory
Definition: nats.h:1100
jsTier::Limits
jsAccountLimits Limits
Definition: nats.h:1104
kvConfig
Definition: nats.h:1402
kvConfig::History
uint8_t History
Definition: nats.h:1406
kvConfig::Bucket
const char * Bucket
Definition: nats.h:1403
kvConfig::MaxBytes
int64_t MaxBytes
Definition: nats.h:1408
kvConfig::MaxValueSize
int32_t MaxValueSize
Definition: nats.h:1405
kvConfig::Replicas
int Replicas
Definition: nats.h:1410
kvConfig::Description
const char * Description
Definition: nats.h:1404
kvConfig::Mirror
jsStreamSource * Mirror
Definition: nats.h:1412
kvConfig::TTL
int64_t TTL
Definition: nats.h:1407
kvConfig::StorageType
jsStorageType StorageType
Definition: nats.h:1409
kvConfig::RePublish
jsRePublish * RePublish
Definition: nats.h:1411
kvConfig::SourcesLen
int SourcesLen
Definition: nats.h:1414
kvConfig::Sources
jsStreamSource ** Sources
Definition: nats.h:1413
kvEntryList
A list of KeyValue store entries.
Definition: nats.h:1472
kvEntryList::Entries
kvEntry ** Entries
Definition: nats.h:1473
kvEntryList::Count
int Count
Definition: nats.h:1474
kvKeysList
A list of KeyValue store keys.
Definition: nats.h:1496
kvKeysList::Count
int Count
Definition: nats.h:1498
kvKeysList::Keys
char ** Keys
Definition: nats.h:1497
kvPurgeOptions
Definition: nats.h:1438
kvPurgeOptions::Timeout
int64_t Timeout
Definition: nats.h:1440
kvPurgeOptions::DeleteMarkersOlderThan
int64_t DeleteMarkersOlderThan
Definition: nats.h:1450
kvWatchOptions
Definition: nats.h:1424
kvWatchOptions::IgnoreDeletes
bool IgnoreDeletes
Definition: nats.h:1425
kvWatchOptions::IncludeHistory
bool IncludeHistory
Definition: nats.h:1426
kvWatchOptions::Timeout
int64_t Timeout
How long to wait (in milliseconds) for some operations to complete.
Definition: nats.h:1428
kvWatchOptions::MetaOnly
bool MetaOnly
Definition: nats.h:1427
micro_endpoint_config_s
Definition: nats.h:7773
micro_endpoint_config_s::Name
const char * Name
The name of the endpoint.
Definition: nats.h:7779
micro_endpoint_config_s::Handler
microRequestHandler Handler
The request handler for the endpoint.
Definition: nats.h:7813
micro_endpoint_config_s::Subject
const char * Subject
The NATS subject the endpoint will listen on.
Definition: nats.h:7790
micro_endpoint_config_s::Metadata
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition: nats.h:7808
micro_endpoint_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition: nats.h:7802
micro_endpoint_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service.
Definition: nats.h:7796
micro_endpoint_config_s::State
void * State
A user-provided pointer to store with the endpoint (state/closure).
Definition: nats.h:7819
micro_endpoint_info_s
Definition: nats.h:7826
micro_endpoint_info_s::Subject
const char * Subject
The semantic version of the service.
Definition: nats.h:7835
micro_endpoint_info_s::Name
const char * Name
The name of the service.
Definition: nats.h:7830
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:7841
micro_endpoint_info_s::Metadata
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition: nats.h:7847
micro_endpoint_stats_s
Definition: nats.h:7854
micro_endpoint_stats_s::Subject
const char * Subject
Definition: nats.h:7856
micro_endpoint_stats_s::NumRequests
int64_t NumRequests
The number of requests received by the endpoint.
Definition: nats.h:7867
micro_endpoint_stats_s::LastErrorString
char LastErrorString[2048]
a copy of the last error message.
Definition: nats.h:7893
micro_endpoint_stats_s::ProcessingTimeSeconds
int64_t ProcessingTimeSeconds
total request processing time (the seconds part).
Definition: nats.h:7878
micro_endpoint_stats_s::ProcessingTimeNanoseconds
int64_t ProcessingTimeNanoseconds
total request processing time (the nanoseconds part).
Definition: nats.h:7883
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:7862
micro_endpoint_stats_s::NumErrors
int64_t NumErrors
The number of errors, service-level and internal, associated with the endpoint.
Definition: nats.h:7873
micro_endpoint_stats_s::AverageProcessingTimeNanoseconds
int64_t AverageProcessingTimeNanoseconds
average request processing time, in ns.
Definition: nats.h:7888
micro_endpoint_stats_s::Name
const char * Name
Definition: nats.h:7855
micro_group_config_s
The Microservice endpoint group configuration object.
Definition: nats.h:7900
micro_group_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition: nats.h:7908
micro_group_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service.
Definition: nats.h:7905
micro_group_config_s::Prefix
const char * Prefix
The subject prefix for the group.
Definition: nats.h:7902
micro_service_config_s
The Microservice top-level configuration object.
Definition: nats.h:7918
micro_service_config_s::Description
const char * Description
The description of the service.
Definition: nats.h:7934
micro_service_config_s::State
void * State
A user-provided pointer to state data.
Definition: nats.h:7998
micro_service_config_s::Version
const char * Version
The (semantic) version of the service.
Definition: nats.h:7929
micro_service_config_s::ErrHandler
microErrorHandler ErrHandler
An error notification handler.
Definition: nats.h:7979
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:7952
micro_service_config_s::NoQueueGroup
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition: nats.h:7946
micro_service_config_s::StatsHandler
microRequestHandler StatsHandler
A custom stats handler.
Definition: nats.h:7970
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:7989
micro_service_config_s::QueueGroup
const char * QueueGroup
Overrides the default queue group for the service ("q").
Definition: nats.h:7940
micro_service_config_s::Name
const char * Name
The name of the service.
Definition: nats.h:7924
micro_service_config_s::Endpoint
microEndpointConfig * Endpoint
The "main" (aka default) endpoint configuration.
Definition: nats.h:7961
micro_service_info_s
Definition: nats.h:8007
micro_service_info_s::Metadata
natsMetadata Metadata
Metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition: nats.h:8036
micro_service_info_s::Name
const char * Name
The name of the service.
Definition: nats.h:8016
micro_service_info_s::Version
const char * Version
The semantic version of the service.
Definition: nats.h:8021
micro_service_info_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.info_response".
Definition: nats.h:8011
micro_service_info_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition: nats.h:8031
micro_service_info_s::Endpoints
microEndpointInfo * Endpoints
Endpoints.
Definition: nats.h:8041
micro_service_info_s::Description
const char * Description
The description of the service.
Definition: nats.h:8026
micro_service_info_s::EndpointsLen
int EndpointsLen
The number of endpoints in the Endpoints array.
Definition: nats.h:8046
micro_service_stats_s
Definition: nats.h:8053
micro_service_stats_s::Started
int64_t Started
The timestamp of when the service was started.
Definition: nats.h:8077
micro_service_stats_s::EndpointsLen
int EndpointsLen
The number of endpoints in the endpoints array.
Definition: nats.h:8087
micro_service_stats_s::Endpoints
microEndpointStats * Endpoints
The stats for each endpoint of the service.
Definition: nats.h:8082
micro_service_stats_s::Version
const char * Version
The semantic version of the service.
Definition: nats.h:8067
micro_service_stats_s::Name
const char * Name
The name of the service.
Definition: nats.h:8062
micro_service_stats_s::Type
const char * Type
Response type. Always "io.nats.micro.v1.stats_response".
Definition: nats.h:8057
micro_service_stats_s::Id
const char * Id
The ID of the service instance responding to the request.
Definition: nats.h:8072
natsMetadata
A type to represent user-provided metadata, a list of k=v pairs.
Definition: nats.h:247
natsMetadata::Count
int Count
Definition: nats.h:251
natsMetadata::List
const char ** List
Definition: nats.h:249
natsMsgList
A list of NATS messages.
Definition: nats.h:235
natsMsgList::Count
int Count
Definition: nats.h:237
natsMsgList::Msgs
natsMsg ** Msgs
Definition: nats.h:236