NATS C Client with JetStream and Streaming support  3.14.0
The nats.io C Client, Supported by Synadia Communications Inc.
Loading...
Searching...
No Matches
nats.h
Go to the documentation of this file.
1// Copyright 2015-2026 The NATS Authors
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef NATS_H_
15#define NATS_H_
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdlib.h>
22#include <stdint.h>
23#include <stdbool.h>
24#include <inttypes.h>
25#include <stdio.h>
26
27#include "status.h"
28#include "version.h"
29
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//
152typedef struct __natsConnection natsConnection;
153
159typedef struct __natsStatistics natsStatistics;
160
165typedef struct __natsSubscription natsSubscription;
166
172typedef struct __natsMsg natsMsg;
173
178typedef struct __natsOptions natsOptions;
179
187typedef char natsInbox;
188
193typedef struct __natsHeader natsHeader;
194
195#ifndef BUILD_IN_DOXYGEN
196// Forward declaration
197typedef void (*natsThreadStartedHandler)(void *closure);
198#endif
199
205typedef struct __natsClientConfig
206{
208
210
211 // Subscription message delivery thread control
214
215 // Reply message delivery thread control
219
220 // Callback invoked when a thread created by the library starts
223
225
249typedef struct natsMsgList
250{
252 int Count;
253
255
260typedef struct natsMetadata
261{
265 const char **List;
269 int Count;
270
272
281typedef struct __jsCtx jsCtx;
282
286typedef struct __jsAtomicBatchCtx jsAtomicBatchCtx;
287
293typedef struct jsScheduleOptions {
294 const char *Schedule;
297 const char *Target;
298 const char *Source;
301 int64_t TTL;
302 const char *TimeZone;
304 bool Rollup;
306
308
339
350
354typedef enum
355{
358
360
364typedef enum
365{
368
370
379
393
397typedef enum
398{
402
403
405
415
424
436typedef struct jsPlacement
437{
438 const char *Cluster;
439 const char **Tags;
441
443
453typedef struct jsExternalStream
454{
455 const char *APIPrefix;
456 const char *DeliverPrefix;
457
459
472typedef struct jsStreamSource
473{
474 const char *Name;
475 uint64_t OptStartSeq;
476 int64_t OptStartTime;
477 const char *FilterSubject;
479 // Domain and External are mutually exclusive.
480 // If Domain is set, an External value will be created with
481 // the APIPrefix constructed based on the Domain value.
482 const char *Domain;
483
485
489typedef struct jsRePublish
490{
491 const char *Source;
492 const char *Destination;
494
496
506
516
691
695typedef struct jsLostStreamData
696{
697 uint64_t *Msgs;
699 uint64_t Bytes;
700
702
709{
710 const char *Subject;
711 uint64_t Msgs;
712
714
750
757typedef struct jsStreamState
758{
759 uint64_t Msgs;
760 uint64_t Bytes;
761 uint64_t FirstSeq;
762 int64_t FirstTime;
763 uint64_t LastSeq;
764 int64_t LastTime;
765 int64_t NumSubjects;
767 uint64_t NumDeleted;
768 uint64_t *Deleted;
771 int64_t Consumers;
772
774
779typedef struct jsPeerInfo
780{
781 char *Name;
784 int64_t Active;
785 uint64_t Lag;
786
788
805
820
824typedef struct jsStreamAlternate
825{
826 const char *Name;
827 const char *Domain;
828 const char *Cluster;
829
831
851
865
873typedef struct jsStreamNamesList
874{
875 char **List;
876 int Count;
877
879
923typedef struct jsConsumerConfig
924{
925 const char *Name;
926 const char *Durable;
927 const char *Description;
929 uint64_t OptStartSeq;
930 int64_t OptStartTime;
932 int64_t AckWait;
933 int64_t MaxDeliver;
934 int64_t *BackOff;
936 const char *FilterSubject;
938 uint64_t RateLimit;
939 const char *SampleFrequency;
940 int64_t MaxWaiting;
943 int64_t Heartbeat;
945
946 // Pull based options.
950
951 // Push based options.
952 const char *DeliverSubject;
953 const char *DeliverGroup;
954
955 // Ephemeral inactivity threshold.
957
958 // Generally inherited by parent stream and other markers, now can be configured directly.
959 int64_t Replicas;
960 // Force memory storage.
962
963 // Configuration options introduced in 2.10
964
965 const char **FilterSubjects;
968
969 // Configuration options introduced in 2.11
970
974 int64_t PauseUntil;
975
979 const char *PriorityPolicy;
980
985 int64_t PinnedTTL;
986
988 const char **PriorityGroups;
991
1016
1032typedef struct jsSubOptions
1033{
1040 const char *Stream;
1050 const char *Consumer;
1065 const char *Queue;
1090 bool Ordered;
1091
1093
1097typedef struct jsSequencePair
1098{
1099 uint64_t Consumer;
1100 uint64_t Stream;
1101
1103
1107typedef struct jsSequenceInfo
1108{
1109 uint64_t Consumer;
1110 uint64_t Stream;
1111 int64_t Last;
1112
1114
1124
1150
1164
1173{
1174 char **List;
1176
1178
1190
1204
1208typedef struct jsAPIStats
1209{
1210 uint64_t Total;
1211 uint64_t Errors;
1212
1214
1230
1231typedef struct jsTier
1232{
1233 const char *Name;
1234 uint64_t Memory;
1235 uint64_t Store;
1236 int64_t Streams;
1237 int64_t Consumers;
1239
1241
1258
1277
1281typedef struct jsPubAck
1282{
1283 char *Stream;
1284 uint64_t Sequence;
1285 char *Domain;
1287 char *Batch;
1288 uint64_t Count;
1289 char *Value;
1290
1292
1305
1306#ifndef BUILD_IN_DOXYGEN
1307// Forward declarations
1308typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
1309typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
1310#endif
1311
1322{
1323 uint64_t Sequence;
1324 const char *NextBySubject;
1325 const char *LastBySubject;
1326
1328
1334typedef struct jsFetchRequest
1335{
1336 int64_t Expires;
1337 int Batch;
1338 int64_t MaxBytes;
1339 bool NoWait;
1340 int64_t Heartbeat;
1341
1342 // The use of these fields require nats-server v2.11.0 or later
1343 int64_t MinPending;
1345 const char *ID;
1347 const char *Group;
1348 // The use of this field require nats-server v2.12.0 or later
1349 uint8_t Priority;
1352
1354
1376typedef void (*jsFetchCompleteHandler)(natsConnection *nc, natsSubscription *sub, natsStatus s, void *closure);
1377
1388typedef bool (*jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure);
1389
1462
1469{
1470 int64_t MaxPending;
1471
1472 // If jsPubAckHandler is specified, the callback will be invoked
1473 // for every asynchronous published message, either as a positive
1474 // result, or with the error encountered when publishing that
1475 // message. If this callback is specified, ErrHandler (see below)
1476 // will be ignored.
1479
1480 // This callback is invoked for messages published asynchronously
1481 // when an error is returned by the server or if the library has
1482 // timed-out waiting for an acknowledgment back from the server
1483 // (if publish uses the jsPubOptions.MaxWait).
1486
1487 int64_t StallWait;
1488
1493
1495
1506{
1507 const char *Subject;
1508 uint64_t Sequence;
1509 uint64_t Keep;
1510
1512
1522
1535
1551
1555typedef struct __kvStore kvStore;
1556
1560typedef struct __kvEntry kvEntry;
1561
1565typedef struct __kvStatus kvStatus;
1566
1570typedef struct __kvWatcher kvWatcher;
1571
1583
1589typedef struct kvConfig
1590{
1591 const char *Bucket;
1592 const char *Description;
1594 uint8_t History;
1595 int64_t TTL;
1596 int64_t MaxBytes;
1603
1604 // When > 0 (nanoseconds), enables per-message TTL on the bucket's
1605 // backing stream and auto-expires the
1606 // delete/purge tombstone markers after this duration. Required for
1607 // kvStore_CreateWithTTL() to take effect. Requires nats-server v2.11+.
1609
1611
1612#ifndef BUILD_IN_DOXYGEN
1613// Forward declaration
1614typedef void (*kvWatchCb)(kvWatcher *w, kvEntry *e, natsStatus s, void *closure);
1615#endif
1616
1622typedef struct kvWatchOptions
1623{
1629
1637
1643
1648 int64_t Timeout;
1649
1660
1667 int64_t Heartbeat;
1668
1680
1688
1694 void* Closure;
1695
1697
1703typedef struct kvPurgeOptions
1704{
1705 // How long to wait (in milliseconds) for some operations to complete.
1706 int64_t Timeout;
1707
1708 // When calling kvStore_PurgeDeletes(), all keys that have a delete or
1709 // purge marker as the last entry are gathered and then those keys
1710 // are purged of their content, including the marker.
1711 // Starting with NATS C client v3.3.0, if this option is not specified,
1712 // only the markers older than 30 minutes will be deleted. Use this
1713 // option to set the limit or a negative value to force removal of
1714 // markers regardless of their age.
1715 // The value is expressed as a time in nanoseconds.
1717
1718 // When > 0, the purge marker
1719 // written by kvStore_Purge() is published with this per-message TTL (in
1720 // milliseconds), so the server auto-expires the purge tombstone after the
1721 // duration. Requires the bucket created with kvConfig.LimitMarkerTTL > 0 and
1722 // nats-server v2.11+. Ignored by kvStore_Delete() (delete markers use the
1723 // bucket-level LimitMarkerTTL).
1724 int64_t TTL;
1725
1727
1745typedef struct kvEntryList
1746{
1749
1751
1769typedef struct kvKeysList
1770{
1771 char **Keys;
1773
1775
1779typedef struct __objStore objStore;
1780
1793typedef struct __objStorePut objStorePut;
1794
1800typedef struct __objStoreGet objStoreGet;
1801
1805typedef struct __objStoreWatcher objStoreWatcher;
1806
1834typedef struct objStoreConfig
1835{
1842 const char *Bucket;
1843
1847 const char *Description;
1848
1855 int64_t TTL;
1856
1862 int64_t MaxBytes;
1863
1870
1877
1885
1892
1899
1901
1909typedef struct objStoreNamesList
1910{
1911 char **List;
1913
1915
1929typedef struct objStoreStatus
1930{
1934 const char *Bucket;
1935
1939 const char *Description;
1940
1944 int64_t TTL;
1945
1950
1955
1960
1964 uint64_t Size;
1965
1971 const char *BackingStore;
1972
1977
1982
1987
1989
2003
2007typedef struct objStoreLink
2008{
2012 const char *Bucket;
2013
2019 const char *Name;
2020
2022
2043
2078
2082typedef struct objStoreInfo
2083{
2088
2092 const char *Bucket;
2093
2097 const char *NUID;
2098
2102 uint64_t Size;
2103
2107 int64_t ModTime;
2108
2114 uint32_t Chunks;
2115
2121 const char *Digest;
2122
2127
2129
2143
2166
2191
2192
2193#if defined(NATS_HAS_STREAMING)
2198typedef struct __stanConnection stanConnection;
2199
2204typedef struct __stanSubscription stanSubscription;
2205
2210typedef struct __stanMsg stanMsg;
2211
2216typedef struct __stanConnOptions stanConnOptions;
2217
2222typedef struct __stanSubOptions stanSubOptions;
2223#endif
2224
// end of typesGroup
2226
2227//
2228// Callbacks.
2229//
2230
2253typedef void (*natsMsgHandler)(
2254 natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure);
2255
2290typedef void (*kvGetCb)(
2291 kvStore *kv, kvEntry *e, natsStatus s, void *closure);
2292
2307 natsConnection *nc, void *closure);
2308
2321 natsSock *fd, char *host, int port, void *closure);
2322
2329typedef void (*natsErrHandler)(
2330 natsConnection *nc, natsSubscription *subscription, natsStatus err,
2331 void *closure);
2332
2347 void **userData,
2348 void *loop,
2349 natsConnection *nc,
2350 natsSock socket);
2351
2362 void *userData,
2363 bool add);
2364
2375 void *userData,
2376 bool add);
2377
2386 void *userData);
2387
2410 char **userJWT,
2411 char **customErrTxt,
2412 void *closure);
2413
2414
2441 char **customErrTxt,
2442 unsigned char **signature,
2443 int *signatureLength,
2444 const char *nonce,
2445 void *closure);
2446
2455typedef const char* (*natsTokenHandler)(void *closure);
2456
2457
2465typedef void (*natsOnCompleteCB)(void *closure);
2466
2487typedef int64_t (*natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure);
2488
2512typedef int (*natsSSLVerifyCb)(int preverifyOk, void *ctx);
2513
2514#ifdef BUILD_IN_DOXYGEN
2548typedef void (*jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure);
2549
2591typedef void (*jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure);
2592
2633typedef void (*natsThreadStartedHandler)(void *closure);
2634
2659typedef void (*kvWatchCb)(kvWatcher *w, kvEntry *e, natsStatus s, void *closure);
2660#endif
2661
2662#if defined(NATS_HAS_STREAMING)
2671typedef void (*stanPubAckHandler)(const char *guid, const char *error, void *closure);
2672
2682typedef void (*stanMsgHandler)(
2683 stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure);
2684
2692 stanConnection *sc, const char* errorTxt, void *closure);
2693#endif
2694
// end of callbacksGroup
2696
2697//
2698// Functions.
2699//
2728
2743nats_Open(int64_t lockSpinCount);
2744
2745
2750NATS_EXTERN const char*
2752
2760NATS_EXTERN uint32_t
2762
2763#ifdef BUILD_IN_DOXYGEN
2778NATS_EXTERN bool
2780#else
2781
2782#define nats_CheckCompatibility() nats_CheckCompatibilityImpl(NATS_VERSION_REQUIRED_NUMBER, \
2783 NATS_VERSION_NUMBER, \
2784 NATS_VERSION_STRING)
2785
2786NATS_EXTERN bool
2787nats_CheckCompatibilityImpl(uint32_t reqVerNumber, uint32_t verNumber, const char *verString);
2788
2789#endif
2790
2795NATS_EXTERN int64_t
2797
2803NATS_EXTERN int64_t
2805
2815NATS_EXTERN int64_t
2817
2825NATS_EXTERN void
2826nats_Sleep(int64_t sleepTime);
2827
2840NATS_EXTERN const char*
2842
2852nats_GetLastErrorStack(char *buffer, size_t bufLen);
2853
2874NATS_EXTERN void
2876
2908
2919NATS_EXTERN void
2921
2947nats_Sign(const char *encodedSeed,
2948 const char *input,
2949 unsigned char **signature,
2950 int *signatureLength);
2951
2972NATS_EXTERN void
2974
3021nats_CloseAndWait(int64_t timeout);
3022
// end of libraryGroup
3024
3040NATS_EXTERN const char*
3042
// end of statusGroup
3044
3064
3083 uint64_t *inMsgs, uint64_t *inBytes,
3084 uint64_t *outMsgs, uint64_t *outBytes,
3085 uint64_t *reconnects);
3086
3093NATS_EXTERN void
3095
// end of statsGroup
3097
3124
3146/*
3147 * The above is for doxygen. The proper syntax for username/password
3148 * is without the '\' character:
3149 *
3150 * nats://localhost:4222
3151 * nats://user@localhost:4222
3152 * nats://user:password@localhost:4222
3153 */
3155natsOptions_SetURL(natsOptions *opts, const char *url);
3156
3172natsOptions_SetServers(natsOptions *opts, const char** servers, int serversCount);
3173
3200natsOptions_SetUserInfo(natsOptions *opts, const char *user, const char *password);
3201
3227natsOptions_SetToken(natsOptions *opts, const char *token);
3228
3246 void *closure);
3247
3259
3273natsOptions_SetTimeout(natsOptions *opts, int64_t timeout);
3274
3283natsOptions_SetName(natsOptions *opts, const char *name);
3284
3303
3325
3366
3384
3402
3431natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates);
3432
3451 const char *certsFileName,
3452 const char *keyFileName);
3453
3471 const char *certsFileName,
3472 const char *keyFileName);
3473
3489 const char *cert,
3490 const char *key);
3491
3510natsOptions_SetCiphers(natsOptions *opts, const char *ciphers);
3511
3528natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers);
3529
3543
3560
3575
3588
3601
3613
3627
3640
3654
3668
3703
3713
3728natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait);
3729
3754natsOptions_SetReconnectJitter(natsOptions *opts, int64_t jitter, int64_t jitterTLS);
3755
3777 void *closure);
3778
3793
3809
3825
3839 void *closure);
3840
3857 void *closure);
3858
3873 void *closure);
3874
3893 natsConnectionHandler disconnectedCb,
3894 void *closure);
3895
3913 natsConnectionHandler reconnectedCb,
3914 void *closure);
3915
3932 natsConnectionHandler discoveredServersCb,
3933 void *closure);
3934
3950
3969 natsConnectionHandler lameDuckCb,
3970 void *closure);
3971
3991 void *loop,
3992 natsEvLoop_Attach attachCb,
3995 natsEvLoop_Detach detachCb);
3996
4021
4046
4080
4128natsOptions_SetFlusherWaitMicros(natsOptions *opts, int64_t flusherWaitUs);
4129
4141
4158
4179
4235 natsConnectionHandler connectedCb, void* closure);
4236
4267 natsUserJWTHandler ujwtCB,
4268 void *ujwtClosure,
4270 void *sigClosure);
4271
4312 const char *userOrChainedFile,
4313 const char *seedFile);
4314
4329 const char *jwtAndSeedContent);
4330
4356 const char *pubKey,
4358 void *sigClosure);
4359
4386 const char *pubKey,
4387 const char *seedFile);
4388
4404
4441
4458natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix);
4459
4475
4483NATS_EXTERN void
4485
// end of optsGroup
4487
4488#if defined(NATS_HAS_STREAMING)
4524
4548
4567
4579
4591
4601
4602
4618stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage);
4619
4636stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut);
4637
4650
4658NATS_EXTERN void
4660
// end of stanConnOptsGroup
4662
4695
4715stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName);
4716
4732
4746
4764
4781
4795
4806
4816
4833
4841NATS_EXTERN void
4843
// end of stanSubOptsGroup
4845#endif
4846
4868
4875NATS_EXTERN void
4877
// end of inboxGroup
4879
4900
4913natsHeader_Set(natsHeader *h, const char *key, const char *value);
4914
4927natsHeader_Add(natsHeader *h, const char *key, const char *value);
4928
4945natsHeader_Get(natsHeader *h, const char *key, const char **value);
4946
4977natsHeader_Values(natsHeader *h, const char *key, const char* **values, int *count);
4978
5008natsHeader_Keys(natsHeader *h, const char* **keys, int *count);
5009
5015NATS_EXTERN int
5017
5030natsHeader_Delete(natsHeader *h, const char *key);
5031
5038NATS_EXTERN void
5040
// end of headerGroup
5042
5061NATS_EXTERN void
5063
5082natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply,
5083 const char *data, int dataLen);
5084
5093NATS_EXTERN const char*
5095
5105NATS_EXTERN const char*
5107
5122natsMsg_SetData(natsMsg *msg, const void *data, int len);
5123
5144NATS_EXTERN const char*
5146
5153NATS_EXTERN int
5155
5172natsMsgHeader_Set(natsMsg *msg, const char *key, const char *value);
5173
5190natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value);
5191
5211natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value);
5212
5247natsMsgHeader_Values(natsMsg *msg, const char *key, const char* **values, int *count);
5248
5279natsMsgHeader_Keys(natsMsg *msg, const char* **keys, int *count);
5280
5295natsMsgHeader_Delete(natsMsg *msg, const char *key);
5296
5305NATS_EXTERN int
5307
5333NATS_EXTERN bool
5335
5342NATS_EXTERN void
5344
// end of msgGroup
5346
5347#if defined(NATS_HAS_STREAMING)
5360NATS_EXTERN uint64_t
5362
5369NATS_EXTERN int64_t
5371
5380NATS_EXTERN bool
5382
5398NATS_EXTERN const char*
5400
5407NATS_EXTERN int
5409
5416NATS_EXTERN void
5418
// end of stanMsgGroup
5420#endif
5421
5454
5466
5477NATS_EXTERN void
5479
5491NATS_EXTERN void
5493
5504NATS_EXTERN void
5506
5517NATS_EXTERN void
5519
5540
5547NATS_EXTERN bool
5549
5556NATS_EXTERN bool
5558
5565NATS_EXTERN bool
5567
5578
5590NATS_EXTERN int
5592
5610
5625
5635NATS_EXTERN int64_t
5637
5649
5660natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize);
5661
5672natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize);
5673
5688natsConnection_GetConnectedServerName(natsConnection *nc, char *buffer, size_t bufferSize);
5689
5711natsConnection_GetServers(natsConnection *nc, char ***servers, int *count);
5712
5734natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count);
5735
5753natsConnection_GetLastError(natsConnection *nc, const char **lastError);
5754
5779
5795
5816
5836
5851 const unsigned char *message, int messageLen,
5852 unsigned char sig[64]);
5853
5874
5888NATS_EXTERN const char*
5890
5903
5913
5935
5945NATS_EXTERN void
5947
5955NATS_EXTERN void
5957
// end of connMgtGroup
5959
5985 const void *data, int dataLen);
5986
6005 const char *str);
6006
6021
6038 const char *reply, const void *data, int dataLen);
6039
6060 const char *reply, const char *str);
6061
6087natsConnection_Request(natsMsg **replyMsg, natsConnection *nc, const char *subj,
6088 const void *data, int dataLen, int64_t timeout);
6089
6115 const char *subj, const char *str,
6116 int64_t timeout);
6117
6136 natsMsg *requestMsg, int64_t timeout);
6137
6162 const void *data, int dataLen);
6163
6181
6199 const char *reply, const void *data, int dataLen);
6200
// end of connPubGroup
6202
6225 const char *subject, natsMsgHandler cb,
6226 void *cbClosure);
6227
6260 const char *subject, int64_t timeout,
6261 natsMsgHandler cb, void *cbClosure);
6262
6275 const char *subject);
6276
6296 const char *subject, const char *queueGroup,
6297 natsMsgHandler cb, void *cbClosure);
6298
6333 const char *subject, const char *queueGroup,
6334 int64_t timeout, natsMsgHandler cb, void *cbClosure);
6335
6349 const char *subject, const char *queueGroup);
6350
// end of connSubGroup
6352
// end of connGroup
6354
6375
6400 int64_t timeout);
6401
6412
6426
6438
6452
6461NATS_EXTERN int64_t
6463
6474NATS_EXTERN const char*
6476
6498natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit);
6499
6520natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit);
6521
6538
6549
6567
6582
6591
6620 int *pendingMsgs,
6621 int *pendingBytes,
6622 int *maxPendingMsgs,
6623 int *maxPendingBytes,
6624 int64_t *deliveredMsgs,
6625 int64_t *droppedMsgs);
6626
6635NATS_EXTERN bool
6637
6657
6710
6735
6763
6794
6802NATS_EXTERN void
6804
// end of subGroup
6806
6807#if defined(NATS_HAS_STREAMING)
6849stanConnection_Connect(stanConnection **sc, const char *clusterID, const char *clientID,
6850 stanConnOptions *options);
6851
6876
6901NATS_EXTERN void
6903
6916
6926
// end of stanConnMgtGroup
6928
6947 const void *data, int dataLen);
6948
6974 const void *data, int dataLen,
6975 stanPubAckHandler ah, void *ahClosure);
6976
// end of stanConnPubGroup
6978
7003 const char *channel, stanMsgHandler cb,
7004 void *cbClosure, stanSubOptions *options);
7005
7027 const char *channel, const char *queueGroup,
7028 stanMsgHandler cb, void *cbClosure, stanSubOptions *options);
7029
// end of stanConnSubGroup
7031
// end of stanConnGroup
7033
7064
7076
7098
7111
7119NATS_EXTERN void
7121
// end of stanSubGroup
7123#endif
7124
7140
7157
7171NATS_EXTERN void
7173
7189
7198
7207
7216
7225
7247
7269
7293js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
7294
7306js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
7307
7326js_GetMsg(natsMsg **msg, jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
7327
7346js_GetLastMsg(natsMsg **msg, jsCtx *js, const char *stream, const char *subject, jsOptions *opts, jsErrCode *errCode);
7347
7357
7381js_DirectGetMsg(natsMsg **msg, jsCtx *js, const char *stream, jsOptions *opts, jsDirectGetMsgOptions *dgOpts);
7382
7400js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
7401
7417js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode);
7418
7446js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
7447
7454NATS_EXTERN void
7456
7473
7483NATS_EXTERN void
7485
7502
7512NATS_EXTERN void
7514
7525
7547 const char *stream, jsConsumerConfig *cfg,
7548 jsOptions *opts, jsErrCode *errCode);
7549
7571 const char *stream, jsConsumerConfig *cfg,
7572 jsOptions *opts, jsErrCode *errCode);
7573
7589 const char *stream, const char *consumer,
7590 jsOptions *opts, jsErrCode *errCode);
7591
7604js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer,
7605 jsOptions *opts, jsErrCode *errCode);
7606
7623 const char *stream, const char *consumer,
7624 uint64_t seq, jsOptions *opts, jsErrCode *errCode);
7625
7632NATS_EXTERN void
7634
7651 const char *stream, const char *consumer,
7652 uint64_t pauseUntil, jsOptions *opts, jsErrCode *errCode);
7653
7660NATS_EXTERN void
7662
7669NATS_EXTERN void
7671
7687js_Consumers(jsConsumerInfoList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
7688
7698NATS_EXTERN void
7700
7716js_ConsumerNames(jsConsumerNamesList **list, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode);
7717
7727NATS_EXTERN void
7729
7746
7753NATS_EXTERN void
7755
// end of jsAssetsGroup
7757
7773
7790js_Publish(jsPubAck **pubAck, jsCtx *js, const char *subj, const void *data, int dataLen,
7791 jsPubOptions *opts, jsErrCode *errCode);
7792
7814 jsPubOptions *opts, jsErrCode *errCode);
7815
7822NATS_EXTERN void
7824
7836js_PublishAsync(jsCtx *js, const char *subj, const void *data, int dataLen,
7837 jsPubOptions *opts);
7838
7864
7878
7929
7948 natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode);
7949
7964 jsPubOptions *opts, jsErrCode *errCode);
7965
7982 jsPubOptions *opts, jsErrCode *errCode);
7983
7984
7991NATS_EXTERN void
7993
// end of jsPubGroup
7995
8011
8058js_Subscribe(natsSubscription **sub, jsCtx *js, const char *subject,
8059 natsMsgHandler cb, void* cbClosure,
8060 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
8061
8080js_SubscribeMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
8081 natsMsgHandler cb, void *cbClosure,
8082 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
8083
8098js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject,
8099 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
8100
8117js_SubscribeSyncMulti(natsSubscription **sub, jsCtx *js, const char **subjects, int numSubjects,
8118 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
8119
8142js_PullSubscribe(natsSubscription **sub, jsCtx *js, const char *subject, const char *durable,
8143 jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode);
8144
8164natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout,
8165 jsErrCode *errCode);
8166
8175
8200js_PullSubscribeAsync(natsSubscription **newsub, jsCtx *js, const char *subject, const char *durable,
8201 natsMsgHandler msgCB, void *msgCBClosure,
8202 jsOptions *jsOpts, jsSubOptions *opts, jsErrCode *errCode);
8203
8218
8238js_UnpinConsumer(jsCtx *js, const char *stream, const char *consumer, const char *group,
8239 jsOptions *opts, jsErrCode *errCode);
8240
8253 jsOptions *opts, jsErrCode *errCode);
8254
8284
// end of jsSubGroup
8286
8309
8316NATS_EXTERN void
8318
8329
8343
8356
8370natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts);
8371
8382
8393
8403NATS_EXTERN uint64_t
8405
8415NATS_EXTERN int64_t
8417
// end of jsMsg
8419
// end of jsGroup
8421
8446
8463
8480js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket);
8481
8492js_DeleteKeyValue(jsCtx *js, const char *bucket);
8493
8501NATS_EXTERN void
8503
// end of kvGroupMgt
8505
8519NATS_EXTERN const char*
8521
8528NATS_EXTERN const char*
8530
8537NATS_EXTERN const void*
8539
8546NATS_EXTERN int
8548
8556NATS_EXTERN const char*
8558
8565NATS_EXTERN uint64_t
8567
8574NATS_EXTERN int64_t
8576
8586NATS_EXTERN uint64_t
8588
8599
8606NATS_EXTERN void
8608
// end of kvEntry
8610
8622kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key);
8623
8678kvStore_GetAsync(kvStore *kv, const char *key, kvGetCb cb, void *cbClosure);
8679
8693kvStore_GetRevision(kvEntry **new_entry, kvStore *kv, const char *key, uint64_t revision);
8694
8706kvStore_Put(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
8707
8722kvStore_PutString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
8723
8735kvStore_Create(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len);
8736
8751kvStore_CreateString(uint64_t *rev, kvStore *kv, const char *key, const char *data);
8752
8771kvStore_CreateWithTTL(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, int64_t ttl);
8772
8778kvStore_CreateStringWithTTL(uint64_t *rev, kvStore *kv, const char *key, const char *data, int64_t ttl);
8779
8792kvStore_Update(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last);
8793
8809kvStore_UpdateString(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last);
8810
8829kvStore_UpdateWithTTL(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last, int64_t ttl);
8830
8836kvStore_UpdateStringWithTTL(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last, int64_t ttl);
8837
8846kvStore_Delete(kvStore *kv, const char *key);
8847
8857kvStore_Purge(kvStore *kv, const char *key, const kvPurgeOptions *opts);
8858
8868
8878
8898
8916kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, const kvWatchOptions *opts);
8917
8940kvStore_WatchMulti(kvWatcher **new_watcher, kvStore *kv, const char **keys, int numKeys, const kvWatchOptions *opts);
8941
8957kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, const kvWatchOptions *opts);
8958
8979
9004kvStore_KeysWithFilters(kvKeysList *list, kvStore *kv, const char **filters, int numFilters, const kvWatchOptions *opts);
9005
9017NATS_EXTERN void
9019
9043kvStore_History(kvEntryList *list, kvStore *kv, const char *key, const kvWatchOptions *opts);
9044
9056NATS_EXTERN void
9058
9068NATS_EXTERN const char*
9070
9071// PurgeDeletes
9072
9084
9108kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout);
9109
9121
9128NATS_EXTERN void
9130
// end of kvWatcher
9132
9146NATS_EXTERN const char*
9148
9155NATS_EXTERN uint64_t
9157
9164NATS_EXTERN int64_t
9166
9173NATS_EXTERN int64_t
9175
9182NATS_EXTERN int64_t
9184
9191NATS_EXTERN uint64_t
9193
9200NATS_EXTERN void
9202
// end of kvStatus
9204
// end of kvGroup
9206
9248
9265
9284
9301js_ObjectStore(objStore **new_obs, jsCtx *js, const char *bucket);
9302
9317
9326NATS_EXTERN void
9328
9343
9352NATS_EXTERN void
9354
9365js_DeleteObjectStore(jsCtx *js, const char *bucket);
9366
// end of obsGroupMgt
9368
9385
9410objStore_GetInfo(objStoreInfo **new_info, objStore *obs, const char *name, objStoreOptions *opts);
9411
9418NATS_EXTERN void
9420
9437objStore_UpdateMeta(objStore *obs, const char *name, objStoreMeta *meta);
9438
9452objStore_Delete(objStore *obs, const char *name);
9453
9473objStore_AddLink(objStoreInfo **new_info, objStore *obs, const char *name, objStoreInfo *obj);
9474
9495objStore_AddBucketLink(objStoreInfo **new_info, objStore *obs, const char *name, objStore *bucket);
9496
9505
9517
9544
9565objStoreWatcher_Next(objStoreInfo **new_info, objStoreWatcher *watcher, int64_t timeout);
9566
9580
9587NATS_EXTERN void
9589
9611
9620NATS_EXTERN void
9622
9637
9644NATS_EXTERN void
9646
9654NATS_EXTERN void
9656
// end of obsMgt
9658
9679
9740
9761objStorePut_Add(objStorePut *put, const void *data, int dataLen);
9762
9779objStorePut_Complete(objStoreInfo **new_info, objStorePut *put, int64_t timeout);
9780
9790NATS_EXTERN void
9792
9812objStore_PutString(objStoreInfo **new_info, objStore *obs, const char *name, const char *data);
9813
9834objStore_PutBytes(objStoreInfo **new_info, objStore *obs, const char *name, const void *data, int dataLen);
9835
9851objStore_PutFile(objStoreInfo **new_info, objStore *obs, const char *fileName);
9852
9964objStore_Get(objStoreGet **new_get, objStore *obs, const char *name, objStoreOptions *opts);
9965
9979
10002objStoreGet_Read(bool *done, void **new_data, int *dataLen, objStoreGet *get, int64_t timeout);
10003
10024objStoreGet_ReadAll(void **new_data, int *dataLen, objStoreGet *get, int64_t timeout);
10025
10032NATS_EXTERN void
10034
10073objStore_GetString(char **new_str, objStore *obs, const char *name, objStoreOptions *opts);
10074
10094objStore_GetBytes(void **new_data, int *dataLen, objStore *obs, const char *name, objStoreOptions *opts);
10095
10113objStore_GetFile(objStore *obs, const char *name, const char *fileName, objStoreOptions *opts);
10114
// end of obsGroup
10116
// end of funcGroup
10118
10119//
10120// Microservices.
10121//
10122
10165typedef struct micro_client_s microClient;
10166
10170typedef struct __for_forward_compatibility_only microClientConfig;
10171
10181typedef struct micro_endpoint_s microEndpoint;
10182
10191
10202
10212
10225typedef struct micro_error_s microError;
10226
10234typedef struct micro_group_s microGroup;
10235
10243
10249typedef struct micro_request_s microRequest;
10250
10262typedef struct micro_service_s microService;
10263
10274
10285
10293
10294
10297
// end of microTypes
10299
10318typedef microError *(*microRequestHandler)(microRequest *req);
10319
10343
10355typedef void (*microDoneHandler)(microService *m);
10356
// end of microCallbacks
10358
10370{
10376 const char *Name;
10377
10387 const char *Subject;
10388
10393 const char *QueueGroup;
10394
10400
10406
10411
10416 void *State;
10417};
10418
10423{
10427 const char *Name;
10428
10432 const char *Subject;
10433
10438 const char *QueueGroup;
10439
10445};
10446
10451{
10452 const char *Name;
10453 const char *Subject;
10454
10459 const char *QueueGroup;
10460
10465
10470 int64_t NumErrors;
10471
10476
10481
10486
10491};
10492
10497{
10499 const char *Prefix;
10500
10502 const char *QueueGroup;
10503
10506};
10507
10515{
10521 const char *Name;
10522
10526 const char *Version;
10527
10531 const char *Description;
10532
10537 const char *QueueGroup;
10538
10544
10550
10559
10568
10577
10587
10595 void *State;
10596};
10597
10604{
10608 const char *Type;
10609
10613 const char *Name;
10614
10618 const char *Version;
10619
10623 const char *Description;
10624
10628 const char *Id;
10629
10634
10639
10644};
10645
10650{
10654 const char *Type;
10655
10659 const char *Name;
10660
10664 const char *Version;
10665
10669 const char *Id;
10670
10674 int64_t Started;
10675
10680
10685};
10686
// end of microStructs
10688
10700#define MICRO_API_PREFIX "$SRV"
10701
10705#define MICRO_INFO_RESPONSE_TYPE "io.nats.micro.v1.info_response"
10706
10710#define MICRO_INFO_VERB "INFO"
10711
10715#define MICRO_PING_RESPONSE_TYPE "io.nats.micro.v1.ping_response"
10716
10720#define MICRO_PING_VERB "PING"
10721
10725#define MICRO_STATS_RESPONSE_TYPE "io.nats.micro.v1.stats_response"
10726
10730#define MICRO_STATS_VERB "STATS"
10731
10736#define MICRO_STATUS_HDR "Nats-Status"
10737
10742#define MICRO_ERROR_HDR "Nats-Service-Error"
10743
10748#define MICRO_ERROR_CODE_HDR "Nats-Service-Error-Code"
10749
// end of microConstants
10751
10783
10799
10816
10830
10841
10856
10866NATS_EXTERN void *
10868
10883
10892NATS_EXTERN bool
10894
10908
10927
// end of microServiceFunctions
10929
10952
10968
// end of microGroupFunctions
10970
10991microRequest_AddHeader(microRequest *req, const char *key, const char *value);
10992
11004
11015
11029NATS_EXTERN const char *
11031
11040NATS_EXTERN int
11042
11052NATS_EXTERN void *
11054
11072microRequest_GetHeaderKeys(microRequest *req, const char ***keys, int *count);
11073
11086microRequest_GetHeaderValue(microRequest *req, const char *key, const char **value);
11087
11104microRequest_GetHeaderValues(microRequest *req, const char *key, const char ***values, int *count);
11105
11114
11124NATS_EXTERN const char *
11126
11135
11144NATS_EXTERN void *
11146
11154NATS_EXTERN const char *
11156
11167microRequest_Respond(microRequest *req, const char *data, size_t len);
11168
11185
11230microRequest_RespondCustom(microRequest *req, microError *err, const char *data, size_t len);
11231
11246microRequest_SetHeader(microRequest *req, const char *key, const char *value);
11247
// end of microRequestFunctions
11249
11266micro_Errorf(const char *format, ...);
11267
11280micro_ErrorfCode(int code, const char *format, ...);
11281
11290
11297NATS_EXTERN int
11299
11304NATS_EXTERN void
11306
11307#define microError_Ignore(__err) microError_Destroy(__err)
11308
11318
11330NATS_EXTERN const char *
11331microError_String(microError *err, char *buf, size_t len);
11332
11347microError_Wrapf(microError *err, const char *format, ...);
11348
// end of microErrorFunctions
11350
11367
11373NATS_EXTERN void
11375
11389microClient_DoRequest(natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len);
11390
// end of microClientFunctions
11392
11404NATS_EXTERN void
11406
11412NATS_EXTERN void
11414
// end of microCleanupFunctions
11416
// end of microFunctions
11418
// end of microGroup
11420
11484#ifdef __cplusplus
11485}
11486#endif
11487
11488#endif /* NATS_H_ */
void(* kvGetCb)(kvStore *kv, kvEntry *e, natsStatus s, void *closure)
Callback invoked with the entry of an asynchronous get.
Definition nats.h:2290
void(* natsOnCompleteCB)(void *closure)
Callback used to notify that an object lifecycle is complete.
Definition nats.h:2465
natsStatus(* natsEvLoop_Attach)(void **userData, void *loop, natsConnection *nc, natsSock socket)
Attach this connection to the external event loop.
Definition nats.h:2346
natsStatus(* natsUserJWTHandler)(char **userJWT, char **customErrTxt, void *closure)
Callback used to fetch and return account signed user JWT.
Definition nats.h:2409
natsStatus(* natsEvLoop_WriteAddRemove)(void *userData, bool add)
Write event needs to be added or removed.
Definition nats.h:2374
int64_t(* natsCustomReconnectDelayHandler)(natsConnection *nc, int attempts, void *closure)
Callback used to specify how long to wait between reconnects.
Definition nats.h:2487
const char *(* natsTokenHandler)(void *closure)
Callback used to build a token on connections and reconnections.
Definition nats.h:2455
void(* jsPubAckHandler)(jsCtx *js, natsMsg *msg, jsPubAck *pa, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish responses from JetStream.
Definition nats.h:2591
void(* jsPubAckErrHandler)(jsCtx *js, jsPubAckErr *pae, void *closure)
Callback used to process asynchronous publish errors from JetStream.
Definition nats.h:2548
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:2329
void(* kvWatchCb)(kvWatcher *w, kvEntry *e, natsStatus s, void *closure)
Callback invoked for each entry of a watcher.
Definition nats.h:2659
natsStatus(* natsEvLoop_Detach)(void *userData)
Detach from the event loop.
Definition nats.h:2385
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:2440
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:2691
int(* natsSSLVerifyCb)(int preverifyOk, void *ctx)
SSL certificate verification callback.
Definition nats.h:2512
void(* natsConnectionHandler)(natsConnection *nc, void *closure)
Callback used to notify the user of asynchronous connection events.
Definition nats.h:2306
void(* natsMsgHandler)(natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition nats.h:2253
void(* stanPubAckHandler)(const char *guid, const char *error, void *closure)
Callback used to notify of an asynchronous publish result.
Definition nats.h:2671
void(* natsThreadStartedHandler)(void *closure)
Callback invoked when a thread created by the library starts.
Definition nats.h:2633
natsStatus(* natsProxyConnHandler)(natsSock *fd, char *host, int port, void *closure)
Callback used to handle connections via proxy.
Definition nats.h:2320
natsStatus(* natsEvLoop_ReadAddRemove)(void *userData, bool add)
Read event needs to be added or removed.
Definition nats.h:2361
void(* stanMsgHandler)(stanConnection *sc, stanSubscription *sub, const char *channel, stanMsg *msg, void *closure)
Callback used to deliver messages to the application.
Definition nats.h:2682
NATS_EXTERN int natsConnection_Buffered(natsConnection *nc)
Returns the number of bytes to be sent to the server.
NATS_EXTERN natsStatus natsConnection_ReadLastError(natsConnection *nc, char *buf, size_t n)
Read the last connection error into a user provided buffer.
NATS_EXTERN void natsConnection_Close(natsConnection *nc)
Closes the connection.
NATS_EXTERN natsStatus natsConnection_Flush(natsConnection *nc)
Flushes the connection.
NATS_EXTERN bool natsConnection_IsDraining(natsConnection *nc)
Test if connection is draining.
NATS_EXTERN natsStatus natsConnection_Reconnect(natsConnection *nc)
Drops the current connection, reconnects including re-subscribing.
NATS_EXTERN natsConnStatus natsConnection_Status(natsConnection *nc)
Returns the current state of the connection.
NATS_EXTERN natsStatus natsConnection_GetConnectedServerId(natsConnection *nc, char *buffer, size_t bufferSize)
Gets the server Id.
NATS_EXTERN bool natsConnection_IsClosed(natsConnection *nc)
Test if connection has been closed.
NATS_EXTERN natsStatus natsConnection_Drain(natsConnection *nc)
Drains the connection with default timeout.
NATS_EXTERN bool natsConnection_IsReconnecting(natsConnection *nc)
Test if connection is reconnecting.
NATS_EXTERN natsStatus natsConnection_GetStats(natsConnection *nc, natsStatistics *stats)
Gets the connection statistics.
NATS_EXTERN int64_t natsConnection_GetMaxPayload(natsConnection *nc)
Returns the maximum message payload.
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.
NATS_EXTERN const char * natsConnection_GetName(natsConnection *nc)
Returns the name of this connection.
NATS_EXTERN natsStatus natsConnection_Connect(natsConnection **nc, natsOptions *options)
Connects to a NATS Server using the provided options.
NATS_EXTERN natsStatus natsConnection_GetClientID(natsConnection *nc, uint64_t *cid)
Gets the current client ID assigned by the server.
NATS_EXTERN natsStatus natsConnection_FlushTimeout(natsConnection *nc, int64_t timeout)
Flushes the connection with a given timeout.
NATS_EXTERN natsStatus natsConnection_GetConnectedServerName(natsConnection *nc, char *buffer, size_t bufferSize)
Gets the server name.
NATS_EXTERN void natsConnection_ProcessDetachedEvent(natsConnection *nc)
Process a detach event when using external event loop.
NATS_EXTERN void natsConnection_ProcessCloseEvent(natsSock *socket)
Process a socket close event when using external event loop.
NATS_EXTERN natsStatus natsConnection_GetLocalIPAndPort(natsConnection *nc, char **ip, int *port)
Returns the connection local IP and port.
NATS_EXTERN natsStatus natsConnection_GetRTT(natsConnection *nc, int64_t *rtt)
Returns the round trip time between this client and the server.
NATS_EXTERN void natsConnection_ProcessReadEvent(natsConnection *nc)
Process a read event when using external event loop.
NATS_EXTERN natsStatus natsConnection_GetLastError(natsConnection *nc, const char **lastError)
Gets the last connection error.
NATS_EXTERN natsStatus natsConnection_GetDiscoveredServers(natsConnection *nc, char ***servers, int *count)
Returns the list of discovered server URLs.
NATS_EXTERN natsStatus natsConnection_HasHeaderSupport(natsConnection *nc)
Returns if the connection to current server supports headers.
NATS_EXTERN void natsConnection_ProcessWriteEvent(natsConnection *nc)
Process a write event when using external event loop.
NATS_EXTERN natsStatus natsConnection_GetClientIP(natsConnection *nc, char **ip)
Returns the client's IP address as reported by the server.
NATS_EXTERN natsStatus natsConnection_DrainTimeout(natsConnection *nc, int64_t timeout)
Drains the connection with given timeout.
NATS_EXTERN natsStatus natsConnection_GetServers(natsConnection *nc, char ***servers, int *count)
Returns the list of server URLs known to this connection.
NATS_EXTERN natsStatus natsConnection_GetConnectedUrl(natsConnection *nc, char *buffer, size_t bufferSize)
Gets the URL of the currently connected server.
NATS_EXTERN natsStatus natsConnection_ConnectTo(natsConnection **nc, const char *urls)
Connects to a NATS Server using any of the URL from the given list.
NATS_EXTERN void natsConnection_Destroy(natsConnection *nc)
Destroys the connection object.
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.
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.
NATS_EXTERN natsStatus natsConnection_SendMsg(natsConnection *nc, natsMsg *msg)
Sends a message with reduced latency.
NATS_EXTERN natsStatus natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg)
Publishes a message on a subject.
NATS_EXTERN natsStatus natsConnection_Send(natsConnection *nc, const char *subj, const void *data, int dataLen)
Sends data on a subject with reduced latency.
NATS_EXTERN natsStatus natsConnection_SendRequest(natsConnection *nc, const char *subj, const char *reply, const void *data, int dataLen)
Sends data with a reply subject with reduced latency.
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.
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.
NATS_EXTERN natsStatus natsConnection_Publish(natsConnection *nc, const char *subj, const void *data, int dataLen)
Publishes data on a subject.
NATS_EXTERN natsStatus natsConnection_PublishString(natsConnection *nc, const char *subj, const char *str)
Publishes a string on a subject.
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.
NATS_EXTERN natsStatus natsConnection_SubscribeSync(natsSubscription **sub, natsConnection *nc, const char *subject)
Creates a synchronous subscription.
NATS_EXTERN natsStatus natsConnection_QueueSubscribe(natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous queue subscriber.
NATS_EXTERN natsStatus natsConnection_QueueSubscribeSync(natsSubscription **sub, natsConnection *nc, const char *subject, const char *queueGroup)
Creates a synchronous queue subscriber.
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.
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.
NATS_EXTERN natsStatus natsConnection_Subscribe(natsSubscription **sub, natsConnection *nc, const char *subject, natsMsgHandler cb, void *cbClosure)
Creates an asynchronous subscription.
NATS_EXTERN natsStatus natsHeader_Delete(natsHeader *h, const char *key)
Delete the value(s) associated with key.
NATS_EXTERN natsStatus natsHeader_Keys(natsHeader *h, const char ***keys, int *count)
Get all header keys.
NATS_EXTERN natsStatus natsHeader_New(natsHeader **new_header)
Creates an header object.
NATS_EXTERN void natsHeader_Destroy(natsHeader *h)
Destroys the natsHeader object.
NATS_EXTERN natsStatus natsHeader_Add(natsHeader *h, const char *key, const char *value)
Add value to the header associated with key.
NATS_EXTERN natsStatus natsHeader_Get(natsHeader *h, const char *key, const char **value)
Get the header entry associated with key.
NATS_EXTERN natsStatus natsHeader_Set(natsHeader *h, const char *key, const char *value)
Set the header entries associated with key to the single element value.
NATS_EXTERN natsStatus natsHeader_Values(natsHeader *h, const char *key, const char ***values, int *count)
Get all header values associated with key.
NATS_EXTERN int natsHeader_KeysCount(natsHeader *h)
Returns the number of keys.
NATS_EXTERN natsStatus natsInbox_Create(natsInbox **newInbox)
Creates an inbox.
NATS_EXTERN void natsInbox_Destroy(natsInbox *inbox)
Destroys the inbox.
NATS_EXTERN natsStatus jsPlacement_Init(jsPlacement *placement)
Initializes a placement configuration structure.
NATS_EXTERN void jsConsumerNamesList_Destroy(jsConsumerNamesList *list)
Destroys the consumer names list object.
NATS_EXTERN natsStatus js_GetConsumerInfo(jsConsumerInfo **ci, jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode)
Retrieves information about a consumer.
NATS_EXTERN natsStatus jsConsumerConfig_Init(jsConsumerConfig *cc)
Initializes a consumer configuration structure.
NATS_EXTERN natsStatus jsRePublish_Init(jsRePublish *rp)
Initializes a republish structure.
NATS_EXTERN void jsStreamInfoList_Destroy(jsStreamInfoList *list)
Destroys the stream information list object.
NATS_EXTERN natsStatus js_DeleteStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Deletes a stream.
NATS_EXTERN void jsConsumerInfoList_Destroy(jsConsumerInfoList *list)
Destroys the consumer information list object.
NATS_EXTERN natsStatus js_DeleteConsumer(jsCtx *js, const char *stream, const char *consumer, jsOptions *opts, jsErrCode *errCode)
Deletes a consumer.
NATS_EXTERN natsStatus js_Streams(jsStreamInfoList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available streams.
NATS_EXTERN natsStatus js_PurgeStream(jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Purges a stream.
NATS_EXTERN natsStatus js_AddStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Creates a stream.
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.
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.
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.
NATS_EXTERN natsStatus js_ResetConsumer(jsConsumerResetResponse **new_crr, jsCtx *js, const char *stream, const char *consumer, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Resets the consumer's delivery state.
NATS_EXTERN natsStatus js_EraseMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Erases a message from the stream.
NATS_EXTERN natsStatus js_UpdateStream(jsStreamInfo **si, jsCtx *js, jsStreamConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Updates a stream.
NATS_EXTERN void jsConsumerPauseResponse_Destroy(jsConsumerPauseResponse *cpr)
Destroys the PauseConsumer response object.
NATS_EXTERN void jsAccountInfo_Destroy(jsAccountInfo *ai)
Destroys the account information object.
NATS_EXTERN natsStatus jsStreamSource_Init(jsStreamSource *source)
Initializes a stream source configuration structure.
NATS_EXTERN natsStatus jsExternalStream_Init(jsExternalStream *external)
Initializes an external stream configuration structure.
NATS_EXTERN natsStatus jsDirectGetMsgOptions_Init(jsDirectGetMsgOptions *opts)
Initializes a direct get message options structure.
NATS_EXTERN void jsStreamInfo_Destroy(jsStreamInfo *si)
Destroys the stream information object.
NATS_EXTERN natsStatus js_GetStreamInfo(jsStreamInfo **si, jsCtx *js, const char *stream, jsOptions *opts, jsErrCode *errCode)
Retrieves information from a stream.
NATS_EXTERN void jsConsumerInfo_Destroy(jsConsumerInfo *ci)
Destroys the consumer information object.
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.
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.
NATS_EXTERN natsStatus jsStreamConfig_Init(jsStreamConfig *cfg)
Initializes a streaming configuration structure.
NATS_EXTERN natsStatus js_StreamNames(jsStreamNamesList **list, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves the list of all available stream names.
NATS_EXTERN natsStatus js_GetAccountInfo(jsAccountInfo **ai, jsCtx *js, jsOptions *opts, jsErrCode *errCode)
Retrieves information about the JetStream usage from an account.
NATS_EXTERN natsStatus js_UpdateConsumer(jsConsumerInfo **ci, jsCtx *js, const char *stream, jsConsumerConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Updates a JetStream consumer.
NATS_EXTERN natsStatus js_DeleteMsg(jsCtx *js, const char *stream, uint64_t seq, jsOptions *opts, jsErrCode *errCode)
Deletes a message from the stream.
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.
NATS_EXTERN natsStatus js_AddConsumer(jsConsumerInfo **ci, jsCtx *js, const char *stream, jsConsumerConfig *cfg, jsOptions *opts, jsErrCode *errCode)
Adds a JetStream consumer.
NATS_EXTERN void jsConsumerResetResponse_Destroy(jsConsumerResetResponse *crr)
Destroys the ResetConsumer response object.
NATS_EXTERN void jsStreamNamesList_Destroy(jsStreamNamesList *list)
Destroys the stream names list object.
NATS_EXTERN natsStatus jsOptions_Init(jsOptions *opts)
Initializes a streaming context options structure.
NATS_EXTERN natsStatus natsConnection_JetStream(jsCtx **js, natsConnection *nc, jsOptions *opts)
Returns a new JetStream context.
NATS_EXTERN void jsCtx_Destroy(jsCtx *js)
Destroys the JetStream context.
NATS_EXTERN uint64_t natsMsg_GetSequence(natsMsg *msg)
Returns the sequence number of this JetStream message.
NATS_EXTERN int64_t natsMsg_GetTime(natsMsg *msg)
Returns the timestamp (in UTC) of this JetStream message.
NATS_EXTERN natsStatus natsMsg_NakWithDelay(natsMsg *msg, int64_t delay, jsOptions *opts)
Negatively acknowledges a message.
NATS_EXTERN natsStatus natsMsg_Nak(natsMsg *msg, jsOptions *opts)
Negatively acknowledges a message.
NATS_EXTERN natsStatus natsMsg_GetMetaData(jsMsgMetaData **new_meta, natsMsg *msg)
Returns metadata from this JetStream message.
NATS_EXTERN natsStatus natsMsg_InProgress(natsMsg *msg, jsOptions *opts)
Resets redelivery timer on the server.
NATS_EXTERN natsStatus natsMsg_Ack(natsMsg *msg, jsOptions *opts)
Acknowledges a message.
NATS_EXTERN natsStatus natsMsg_Term(natsMsg *msg, jsOptions *opts)
Abandon this message.
NATS_EXTERN void jsMsgMetaData_Destroy(jsMsgMetaData *meta)
Destroys the message metadata object.
NATS_EXTERN natsStatus natsMsg_AckSync(natsMsg *msg, jsOptions *opts, jsErrCode *errCode)
Acknowledges a message and wait for a confirmation.
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.
NATS_EXTERN natsStatus js_PublishAsyncComplete(jsCtx *js, jsPubOptions *opts)
Wait for all outstanding messages to be acknowledged.
NATS_EXTERN natsStatus js_PublishAsyncGetPendingList(natsMsgList *pending, jsCtx *js)
Returns the list of pending messages published asynchronously.
NATS_EXTERN natsStatus js_PublishMsg(jsPubAck **pubAck, jsCtx *js, natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode)
Publishes a message to JetStream.
NATS_EXTERN void jsPubAck_Destroy(jsPubAck *pubAck)
Destroys the publish acknowledgment object.
NATS_EXTERN natsStatus js_BatchPublishCommit(jsPubAck **new_puback, jsAtomicBatchCtx *ctx, natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode)
Commits the batch publish.
NATS_EXTERN void jsAtomicBatchCtx_Destroy(jsAtomicBatchCtx *ctx)
Destroys the atomic batch context object.
NATS_EXTERN natsStatus js_PublishMsgAsync(jsCtx *js, natsMsg **msg, jsPubOptions *opts)
Publishes a message to JetStream but does not wait for a jsPubAck.
NATS_EXTERN natsStatus js_BatchPublishStart(jsAtomicBatchCtx **ctx, jsPubAck **new_puback, jsCtx *js, natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode)
Starts an atomic batch 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.
NATS_EXTERN natsStatus jsPubOptions_Init(jsPubOptions *opts)
Initializes a publish options structure.
NATS_EXTERN natsStatus js_BatchPublishAdd(jsPubAck **new_puback, jsAtomicBatchCtx *ctx, natsMsg *msg, jsPubOptions *opts, jsErrCode *errCode)
Adds a message to the batch publish.
NATS_EXTERN natsStatus natsSubscription_GetSequenceMismatch(jsConsumerSequenceMismatch *csm, natsSubscription *sub)
Returns the consumer sequence mismatch information.
NATS_EXTERN natsStatus jsFetchRequest_Init(jsFetchRequest *request)
Initializes a fetch request options structure.
NATS_EXTERN natsStatus jsSubOptions_Init(jsSubOptions *opts)
Initializes a subscribe options structure.
NATS_EXTERN natsStatus js_UnpinConsumer(jsCtx *js, const char *stream, const char *consumer, const char *group, jsOptions *opts, jsErrCode *errCode)
Un-pins a consumer priority group from a specific subscription.
NATS_EXTERN natsStatus natsSubscription_FetchRequest(natsMsgList *list, natsSubscription *sub, jsFetchRequest *request)
Fetches messages for a pull subscription with a complete request configuration.
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.
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.
NATS_EXTERN natsStatus natsSubscription_GetConsumerInfo(jsConsumerInfo **ci, natsSubscription *sub, jsOptions *opts, jsErrCode *errCode)
Returns the jsConsumerInfo associated with this subscription.
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.
NATS_EXTERN natsStatus js_SubscribeSync(natsSubscription **sub, jsCtx *js, const char *subject, jsOptions *opts, jsSubOptions *subOpts, jsErrCode *errCode)
Create a synchronous subscription.
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.
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.
NATS_EXTERN natsStatus natsSubscription_Fetch(natsMsgList *list, natsSubscription *sub, int batch, int64_t timeout, jsErrCode *errCode)
Fetches messages for a pull subscription.
NATS_EXTERN const char * kvEntry_Key(const kvEntry *e)
Returns the name of the key that was retrieved.
NATS_EXTERN const void * kvEntry_Value(const kvEntry *e)
Returns the value for this key.
NATS_EXTERN int64_t kvEntry_Created(const kvEntry *e)
Returns the time (in UTC) the data was put in the bucket.
NATS_EXTERN uint64_t kvEntry_Revision(const kvEntry *e)
Returns the unique sequence for this value.
NATS_EXTERN uint64_t kvEntry_Delta(const kvEntry *e)
Returns the distance from the latest value.
NATS_EXTERN void kvEntry_Destroy(kvEntry *e)
Destroys the KeyValue entry object.
NATS_EXTERN const char * kvEntry_ValueString(const kvEntry *e)
Returns the value, as a string, for this key.
NATS_EXTERN const char * kvEntry_Bucket(const kvEntry *e)
Returns the name of the bucket the data was loaded from.
NATS_EXTERN kvOperation kvEntry_Operation(const kvEntry *e)
Returns the type of operation of this value.
NATS_EXTERN int kvEntry_ValueLen(const kvEntry *e)
Returns the value length for this key.
NATS_EXTERN void kvKeysList_Destroy(kvKeysList *list)
Destroys this list of KeyValue store key strings.
NATS_EXTERN natsStatus kvStore_WatchAll(kvWatcher **new_watcher, kvStore *kv, const kvWatchOptions *opts)
Returns a watcher for any updates to any keys of the KeyValue store bucket.
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...
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.
NATS_EXTERN natsStatus kvPurgeOptions_Init(kvPurgeOptions *opts)
Initializes a KeyValue purge options structure.
NATS_EXTERN natsStatus kvStore_Get(kvEntry **new_entry, kvStore *kv, const char *key)
Returns the latest entry for the key.
NATS_EXTERN natsStatus kvStore_Keys(kvKeysList *list, kvStore *kv, const kvWatchOptions *opts)
Returns all keys in the bucket.
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.
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.
NATS_EXTERN natsStatus kvStore_UpdateStringWithTTL(uint64_t *rev, kvStore *kv, const char *key, const char *data, uint64_t last, int64_t ttl)
String variant of kvStore_UpdateWithTTL.
NATS_EXTERN natsStatus kvStore_Watch(kvWatcher **new_watcher, kvStore *kv, const char *keys, const kvWatchOptions *opts)
Returns a watcher for any updates to keys that match the keys argument.
NATS_EXTERN natsStatus kvStore_Delete(kvStore *kv, const char *key)
Deletes a key by placing a delete marker and leaving all revisions.
NATS_EXTERN natsStatus kvStore_WatchMulti(kvWatcher **new_watcher, kvStore *kv, const char **keys, int numKeys, const kvWatchOptions *opts)
Returns a watcher for any updates to keys that match one of the keys argument.
NATS_EXTERN natsStatus kvStore_Purge(kvStore *kv, const char *key, const kvPurgeOptions *opts)
Deletes a key by placing a purge marker and removing all revisions.
NATS_EXTERN natsStatus kvStore_PurgeDeletes(kvStore *kv, const kvPurgeOptions *opts)
Purge and removes delete markers.
NATS_EXTERN natsStatus kvWatchOptions_Init(kvWatchOptions *opts)
Initializes a KeyValue watcher options structure.
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.
NATS_EXTERN const char * kvStore_Bucket(const kvStore *kv)
Returns the bucket name of this KeyValue store object.
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.
NATS_EXTERN natsStatus kvStore_UpdateWithTTL(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, uint64_t last, int64_t ttl)
Updates a key with a per-key TTL if and only if the latest revision matches.
NATS_EXTERN natsStatus kvStore_CreateStringWithTTL(uint64_t *rev, kvStore *kv, const char *key, const char *data, int64_t ttl)
String variant of kvStore_CreateWithTTL.
NATS_EXTERN natsStatus kvStore_CreateWithTTL(uint64_t *rev, kvStore *kv, const char *key, const void *data, int len, int64_t ttl)
Create-if-absent with a per-key TTL.
NATS_EXTERN natsStatus kvStore_History(kvEntryList *list, kvStore *kv, const char *key, const kvWatchOptions *opts)
Returns all historical entries for the key.
NATS_EXTERN natsStatus kvStore_KeysWithFilters(kvKeysList *list, kvStore *kv, const char **filters, int numFilters, const kvWatchOptions *opts)
Returns all keys in the bucket which matches the list of subject like filters.
NATS_EXTERN natsStatus kvStore_Status(kvStatus **new_status, kvStore *kv)
Returns the status and configuration of a bucket.
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.
NATS_EXTERN void kvEntryList_Destroy(kvEntryList *list)
Destroys this list of KeyValue store entries.
NATS_EXTERN natsStatus kvStore_GetAsync(kvStore *kv, const char *key, kvGetCb cb, void *cbClosure)
Asynchronously returns the latest entry for the key.
NATS_EXTERN natsStatus kvConfig_Init(kvConfig *cfg)
Initializes a KeyValue configuration structure.
NATS_EXTERN natsStatus js_KeyValue(kvStore **new_kv, jsCtx *js, const char *bucket)
Looks-up and binds to an existing KeyValue store.
NATS_EXTERN natsStatus js_DeleteKeyValue(jsCtx *js, const char *bucket)
Deletes a KeyValue store.
NATS_EXTERN void kvStore_Destroy(kvStore *kv)
Destroys a KeyValue store object.
NATS_EXTERN natsStatus js_CreateKeyValue(kvStore **new_kv, jsCtx *js, kvConfig *cfg)
Creates a KeyValue store with a given configuration.
NATS_EXTERN uint64_t kvStatus_Values(const kvStatus *sts)
Returns how many messages are in the bucket, including historical values.
NATS_EXTERN void kvStatus_Destroy(kvStatus *sts)
Destroys the KeyValue status object.
NATS_EXTERN const char * kvStatus_Bucket(const kvStatus *sts)
Returns the bucket name.
NATS_EXTERN uint64_t kvStatus_Bytes(const kvStatus *sts)
Returns the size (in bytes) of this bucket.
NATS_EXTERN int64_t kvStatus_Replicas(const kvStatus *sts)
Returns the number of replicas to keep for a bucket.
NATS_EXTERN int64_t kvStatus_TTL(const kvStatus *sts)
Returns how long the bucket keeps values for.
NATS_EXTERN int64_t kvStatus_History(const kvStatus *sts)
Returns the configured history kept per key.
NATS_EXTERN void kvWatcher_Destroy(kvWatcher *w)
Destroys the KeyValue watcher object.
NATS_EXTERN natsStatus kvWatcher_Next(kvEntry **new_entry, kvWatcher *w, int64_t timeout)
Returns the next entry for this watcher.
NATS_EXTERN natsStatus kvWatcher_Stop(kvWatcher *w)
Stops the watcher.
NATS_EXTERN const char * nats_GetVersion(void)
Returns the Library's version.
NATS_EXTERN natsStatus nats_Open(int64_t lockSpinCount)
Initializes the library.
NATS_EXTERN void nats_PrintLastErrorStack(FILE *file)
Prints the calling thread's last known error stack into the file.
NATS_EXTERN uint32_t nats_GetVersionNumber(void)
Returns the Library's version as a number.
NATS_EXTERN bool nats_CheckCompatibility(void)
Check that the header is compatible with the library.
NATS_EXTERN int64_t nats_Now(void)
Gives the current time in milliseconds.
NATS_EXTERN int64_t nats_NowMonotonicInNanoSeconds(void)
Gives the current time in nanoseconds using monotonic timer.
NATS_EXTERN natsStatus nats_SetMessageDeliveryPoolSize(int max)
Sets the maximum size of the global message delivery thread pool.
NATS_EXTERN natsStatus nats_OpenWithConfig(natsClientConfig *config)
Initializes the library.
NATS_EXTERN natsStatus nats_GetLastErrorStack(char *buffer, size_t bufLen)
Returns the calling thread's last known error stack.
NATS_EXTERN int64_t nats_NowInNanoSeconds(void)
Gives the current time in nanoseconds.
NATS_EXTERN void nats_Sleep(int64_t sleepTime)
Sleeps for a given number of milliseconds.
NATS_EXTERN const char * nats_GetLastError(natsStatus *status)
Returns the calling thread's last known error.
NATS_EXTERN void nats_Close(void)
Tear down the library.
NATS_EXTERN natsStatus nats_CloseAndWait(int64_t timeout)
Tear down the library and wait for all resources to be released.
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_EXTERN void nats_ReleaseThreadMemory(void)
Release thread-local memory possibly allocated by the library.
void(* microErrorHandler)(microService *m, microEndpoint *ep, natsStatus s)
Callback type for async error notifications.
Definition nats.h:10342
microError *(* microRequestHandler)(microRequest *req)
Callback type for request processing.
Definition nats.h:10318
void(* microDoneHandler)(microService *m)
Callback type for Done (service stopped) notifications.
Definition nats.h:10355
NATS_EXTERN void microServiceInfo_Destroy(microServiceInfo *info)
Destroys a microServiceInfo object.
NATS_EXTERN void microServiceStats_Destroy(microServiceStats *stats)
Destroys a microServiceStats object.
NATS_EXTERN microError * micro_NewClient(microClient **new_client, natsConnection *nc, microClientConfig *cfg)
Creates a new microservice client.
NATS_EXTERN void microClient_Destroy(microClient *client)
Destroys a microservice client.
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.
NATS_EXTERN void microError_Destroy(microError *err)
destroys a microError.
NATS_EXTERN natsStatus microError_Status(microError *err)
Returns the NATS status associated with the error.
NATS_EXTERN int microError_Code(microError *err)
returns the int code of the error.
NATS_EXTERN microError * micro_Errorf(const char *format,...)
creates a new microError, with a printf-like formatted message.
NATS_EXTERN microError * micro_ErrorfCode(int code, const char *format,...)
creates a new microError, with a code and a printf-like formatted message.
NATS_EXTERN const char * microError_String(microError *err, char *buf, size_t len)
Returns a printable string with the error message.
NATS_EXTERN microError * micro_ErrorFromStatus(natsStatus s)
Wraps a NATS status into a microError, if not a NATS_OK.
NATS_EXTERN microError * microError_Wrapf(microError *err, const char *format,...)
Wraps an existing microError with a higher printf-like formatted message.
NATS_EXTERN microError * microGroup_AddEndpoint(microGroup *g, microEndpointConfig *config)
Adds an endpoint to a microGroup and starts listening for messages.
NATS_EXTERN microError * microGroup_AddGroup(microGroup **new_group, microGroup *parent, microGroupConfig *config)
Adds a sub-group to microGroup.
NATS_EXTERN microService * microRequest_GetService(microRequest *req)
Returns the pointer to the microservice associated with the request.
NATS_EXTERN int microRequest_GetDataLength(microRequest *req)
Returns the number of data bytes in the the request.
NATS_EXTERN microError * microRequest_RespondError(microRequest *req, microError *err)
Respond to a request with a simple error.
NATS_EXTERN const char * microRequest_GetSubject(microRequest *req)
Returns the subject of the request message.
NATS_EXTERN const char * microRequest_GetData(microRequest *req)
Returns the data in the the request, as a byte array.
NATS_EXTERN microError * microRequest_AddHeader(microRequest *req, const char *key, const char *value)
Adds a header to the underlying NATS request message.
NATS_EXTERN natsConnection * microRequest_GetConnection(microRequest *req)
Returns the connection associated with the request.
NATS_EXTERN natsMsg * microRequest_GetMsg(microRequest *req)
Get the NATS message underlying the request.
NATS_EXTERN void * microRequest_GetServiceState(microRequest *req)
Returns the pointer to the user-provided service state.
NATS_EXTERN microError * microRequest_Respond(microRequest *req, const char *data, size_t len)
Respond to a request, on the same NATS connection.
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.
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.
NATS_EXTERN void * microRequest_GetEndpointState(microRequest *req)
Returns the pointer to the user-provided endpoint state, if the request is associated with an endpoin...
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.
NATS_EXTERN microError * microRequest_DeleteHeader(microRequest *req, const char *key)
Deletes a header from the underlying NATS request message.
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.
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.
NATS_EXTERN const char * microRequest_GetReply(microRequest *req)
Returns the reply subject set in this message.
NATS_EXTERN microError * microService_GetStats(microServiceStats **new_stats, microService *m)
Returns run-time statistics for a microservice.
NATS_EXTERN natsConnection * microService_GetConnection(microService *m)
Returns the connection associated with the service. If the service was successfully started,...
NATS_EXTERN microError * microService_AddGroup(microGroup **new_group, microService *m, microGroupConfig *config)
Adds an group (prefix) to a microservice.
NATS_EXTERN microError * micro_AddService(microService **new_microservice, natsConnection *nc, microServiceConfig *config)
Creates and starts a new microservice.
NATS_EXTERN microError * microService_Destroy(microService *m)
Destroys a microservice, stopping it first if needed.
NATS_EXTERN microError * microService_Stop(microService *m)
Stops a running microservice.
NATS_EXTERN bool microService_IsStopped(microService *m)
Checks if the service is stopped.
NATS_EXTERN microError * microService_AddEndpoint(microService *m, microEndpointConfig *config)
Adds an endpoint to a microservice and starts listening for messages.
NATS_EXTERN microError * microService_GetInfo(microServiceInfo **new_info, microService *m)
Returns a microServiceInfo for a microservice.
NATS_EXTERN microError * microService_Run(microService *m)
Waits for a microservice to stop.
NATS_EXTERN void * microService_GetState(microService *m)
Returns the pointer to state data (closure). It is originally provided in microServiceConfig....
struct micro_client_s microClient
The Microservice client.
Definition nats.h:10165
struct micro_group_s microGroup
a collection of endpoints and other groups, with a common prefix to their subjects and names.
Definition nats.h:10234
struct micro_request_s microRequest
a request received by a microservice endpoint.
Definition nats.h:10249
struct micro_error_s microError
the Microservice error object.
Definition nats.h:10225
struct __for_forward_compatibility_only microClientConfig
The Microservice configuration object. For forward compatibility only.
Definition nats.h:10170
NATS_EXTERN microError * micro_ErrorInvalidArg
NATS_EXTERN microError * micro_ErrorOutOfMemory
struct micro_endpoint_s microEndpoint
microEndpoint represents a microservice endpoint.
Definition nats.h:10181
struct micro_service_s microService
the main object for a configured microservice.
Definition nats.h:10262
NATS_EXTERN natsStatus natsMsg_Create(natsMsg **newMsg, const char *subj, const char *reply, const char *data, int dataLen)
Creates a natsMsg object.
NATS_EXTERN void natsMsgList_Destroy(natsMsgList *list)
Destroys this list of messages.
NATS_EXTERN int natsMsgHeader_EncodedLength(const natsMsg *msg)
Returns the encoded length of the message headers.
NATS_EXTERN int natsMsg_GetDataLength(const natsMsg *msg)
Returns the message length.
NATS_EXTERN natsStatus natsMsgHeader_Add(natsMsg *msg, const char *key, const char *value)
Add value to the header associated with key.
NATS_EXTERN bool natsMsg_IsNoResponders(natsMsg *msg)
Indicates if this message is a "no responders" message from the server.
NATS_EXTERN const char * natsMsg_GetData(const natsMsg *msg)
Returns the message payload.
NATS_EXTERN natsStatus natsMsgHeader_Keys(natsMsg *msg, const char ***keys, int *count)
Get all header keys.
NATS_EXTERN const char * natsMsg_GetReply(const natsMsg *msg)
Returns the reply set in this message.
NATS_EXTERN natsStatus natsMsg_SetData(natsMsg *msg, const void *data, int len)
Sets the message payload.
NATS_EXTERN void natsMsg_Destroy(natsMsg *msg)
Destroys the message object.
NATS_EXTERN natsStatus natsMsgHeader_Get(natsMsg *msg, const char *key, const char **value)
Get the header entry associated with key.
NATS_EXTERN natsStatus natsMsgHeader_Delete(natsMsg *msg, const char *key)
Delete the value(s) associated with key.
NATS_EXTERN const char * natsMsg_GetSubject(const natsMsg *msg)
Returns the subject set in this message.
NATS_EXTERN natsStatus natsMsgHeader_Values(natsMsg *msg, const char *key, const char ***values, int *count)
Get all header values associated with key.
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.
NATS_EXTERN natsStatus objStorePut_Add(objStorePut *put, const void *data, int dataLen)
Add data to the object.
NATS_EXTERN void objStoreGet_Destroy(objStoreGet *get)
Destroys the object store's get object.
NATS_EXTERN natsStatus objStoreGet_ReadAll(void **new_data, int *dataLen, objStoreGet *get, int64_t timeout)
Returns the remaining bytes of the pulled object.
NATS_EXTERN natsStatus objStore_PutFile(objStoreInfo **new_info, objStore *obs, const char *fileName)
Put the content of a file into this object.
NATS_EXTERN natsStatus objStore_Put(objStorePut **new_put, objStore *obs, objStoreMeta *meta)
Initiates a session to put bytes into an object.
NATS_EXTERN natsStatus objStoreMeta_Init(objStoreMeta *meta)
Initializes an object store meta structure.
NATS_EXTERN natsStatus objStoreGet_Read(bool *done, void **new_data, int *dataLen, objStoreGet *get, int64_t timeout)
Returns some bytes of the pulled object.
NATS_EXTERN natsStatus objStorePut_Complete(objStoreInfo **new_info, objStorePut *put, int64_t timeout)
Complete a put operation.
NATS_EXTERN natsStatus objStore_GetString(char **new_str, objStore *obs, const char *name, objStoreOptions *opts)
Pull the named object from the object store and return it as a string.
NATS_EXTERN natsStatus objStore_GetFile(objStore *obs, const char *name, const char *fileName, objStoreOptions *opts)
Pull the named object from the object store and place it into a file.
NATS_EXTERN natsStatus objStore_Get(objStoreGet **new_get, objStore *obs, const char *name, objStoreOptions *opts)
Pull the named object from the object store.
NATS_EXTERN natsStatus objStore_PutBytes(objStoreInfo **new_info, objStore *obs, const char *name, const void *data, int dataLen)
Put bytes into this object.
NATS_EXTERN natsStatus objStore_PutString(objStoreInfo **new_info, objStore *obs, const char *name, const char *data)
Put a string into this object.
NATS_EXTERN void objStorePut_Destroy(objStorePut *put)
Destroys the object store's put object.
NATS_EXTERN natsStatus objStoreGet_Info(const objStoreInfo **new_info, objStoreGet *get)
Returns a handle to the information object own by the objStoreGet object.
NATS_EXTERN natsStatus objStore_GetBytes(void **new_data, int *dataLen, objStore *obs, const char *name, objStoreOptions *opts)
Pull the named object from the object store and return it as a byte array.
NATS_EXTERN natsStatus js_ObjectStoreNames(objStoreNamesList **new_list, jsCtx *js)
Retrieves a list of bucket names.
NATS_EXTERN natsStatus js_DeleteObjectStore(jsCtx *js, const char *bucket)
Deletes an object store.
NATS_EXTERN natsStatus objStoreConfig_Init(objStoreConfig *cfg)
Initializes an Object Store configuration structure.
NATS_EXTERN natsStatus js_ObjectStoreStatuses(objStoreStatusesList **new_list, jsCtx *js)
Retrieves a list of bucket statuses.
NATS_EXTERN natsStatus js_CreateObjectStore(objStore **new_obs, jsCtx *js, objStoreConfig *cfg)
Creates an object store with a given configuration.
NATS_EXTERN void objStoreStatusesList_Destroy(objStoreStatusesList *list)
Destroys the object store statuses list object.
NATS_EXTERN void objStoreNamesList_Destroy(objStoreNamesList *list)
Destroys the object store names list object.
NATS_EXTERN natsStatus js_UpdateObjectStore(objStore **new_obs, jsCtx *js, objStoreConfig *cfg)
Updates an object store with a given configuration.
NATS_EXTERN natsStatus js_ObjectStore(objStore **new_obs, jsCtx *js, const char *bucket)
Looks-up and binds to an existing object store.
NATS_EXTERN void objStoreInfo_Destroy(objStoreInfo *info)
Destroys the ObjectStore information object.
NATS_EXTERN natsStatus objStoreWatchOptions_Init(objStoreWatchOptions *opts)
Initializes the object store watcher options object.
NATS_EXTERN void objStoreWatcher_Destroy(objStoreWatcher *watcher)
Destroys the object store's watcher object.
NATS_EXTERN natsStatus objStore_Status(objStoreStatus **new_status, objStore *obs)
Retrieve the status and configuration of the bucket.
NATS_EXTERN void objStore_Destroy(objStore *obs)
Destroys an object store object.
NATS_EXTERN natsStatus objStore_AddBucketLink(objStoreInfo **new_info, objStore *obs, const char *name, objStore *bucket)
Adds a link to another object store.
NATS_EXTERN natsStatus objStoreOptions_Init(objStoreOptions *opts)
Initializes an Object Store options structure.
NATS_EXTERN natsStatus objStore_GetInfo(objStoreInfo **new_info, objStore *obs, const char *name, objStoreOptions *opts)
Retrieves the current information for the object.
NATS_EXTERN natsStatus objStore_AddLink(objStoreInfo **new_info, objStore *obs, const char *name, objStoreInfo *obj)
Adds a link to another object.
NATS_EXTERN natsStatus objStoreWatcher_Stop(objStoreWatcher *watcher)
Stops the object store watcher.
NATS_EXTERN void objStoreStatus_Destroy(objStoreStatus *status)
Destroys the object store status object.
NATS_EXTERN natsStatus objStore_Delete(objStore *obs, const char *name)
Deletes the named object from the object store.
NATS_EXTERN natsStatus objStore_UpdateMeta(objStore *obs, const char *name, objStoreMeta *meta)
Updates the metadata for the object.
NATS_EXTERN natsStatus objStore_Watch(objStoreWatcher **new_watcher, objStore *obs, objStoreWatchOptions *opts)
Watches for updates to objects in the store.
NATS_EXTERN natsStatus objStoreWatcher_Next(objStoreInfo **new_info, objStoreWatcher *watcher, int64_t timeout)
Returns the next object store information for this object store watcher.
NATS_EXTERN void objStoreInfoList_Destroy(objStoreInfoList *list)
Destroys the list of object information.
NATS_EXTERN natsStatus objStore_Seal(objStore *obs)
Seals the object store.
NATS_EXTERN natsStatus objStore_List(objStoreInfoList **new_list, objStore *obs, objStoreOptions *opts)
Lists information about objects in the object store.
NATS_EXTERN natsStatus natsOptions_SetNKey(natsOptions *opts, const char *pubKey, natsSignatureHandler sigCB, void *sigClosure)
Sets the NKey public key and signature callback.
NATS_EXTERN natsStatus natsOptions_SetExpectedHostname(natsOptions *opts, const char *hostname)
Sets the server certificate's expected hostname.
NATS_EXTERN natsStatus natsOptions_SetErrorHandler(natsOptions *opts, natsErrHandler errHandler, void *closure)
Sets the error handler for asynchronous events.
NATS_EXTERN natsStatus natsOptions_SetTimeout(natsOptions *opts, int64_t timeout)
Sets the (re)connect process timeout.
NATS_EXTERN natsStatus natsOptions_DisableNoResponders(natsOptions *opts, bool disabled)
Enable/Disable the "no responders" feature.
NATS_EXTERN natsStatus natsOptions_SetIOBufSize(natsOptions *opts, int ioBufSize)
Sets the size of the internal read/write buffers.
NATS_EXTERN natsStatus natsOptions_SetName(natsOptions *opts, const char *name)
Sets the name.
NATS_EXTERN natsStatus natsOptions_SetReconnectOnProtocolError(natsOptions *opts, bool reconnect)
Controls whether a generic server protocol error triggers a reconnect instead of permanently closing ...
NATS_EXTERN natsStatus natsOptions_SetRetryOnFailedConnect(natsOptions *opts, bool retry, natsConnectionHandler connectedCb, void *closure)
Indicates if initial connect failure should be retried or not.
NATS_EXTERN natsStatus natsOptions_SetTokenHandler(natsOptions *opts, natsTokenHandler tokenCb, void *closure)
Sets the tokenCb to use whenever a token is needed.
NATS_EXTERN natsStatus natsOptions_SetSSLVerificationCallback(natsOptions *opts, natsSSLVerifyCb callback)
EXPERIMENTAL Sets the certificate validation callback.
NATS_EXTERN natsStatus natsOptions_SetReconnectedCB(natsOptions *opts, natsConnectionHandler reconnectedCb, void *closure)
Sets the callback to be invoked when the connection has reconnected.
NATS_EXTERN natsStatus natsOptions_SetPedantic(natsOptions *opts, bool pedantic)
Sets the pedantic mode.
NATS_EXTERN natsStatus natsOptions_SetReconnectWait(natsOptions *opts, int64_t reconnectWait)
Sets the time between reconnect attempts.
NATS_EXTERN natsStatus natsOptions_SetCipherSuites(natsOptions *opts, const char *ciphers)
Sets the list of available ciphers for TLSv1.3.
NATS_EXTERN natsStatus natsOptions_LoadCATrustedCertificates(natsOptions *opts, const char *fileName)
Loads the trusted CA certificates from a file.
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.
NATS_EXTERN natsStatus natsOptions_LoadCertificatesChain(natsOptions *opts, const char *certsFileName, const char *keyFileName)
Loads the certificate chain from a file, using the given key.
NATS_EXTERN natsStatus natsOptions_SetAllowReconnect(natsOptions *opts, bool allow)
Indicates if the connection will be allowed to reconnect.
NATS_EXTERN natsStatus natsOptions_SetURL(natsOptions *opts, const char *url)
Sets the URL to connect to.
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.
NATS_EXTERN natsStatus natsOptions_SetNoEcho(natsOptions *opts, bool noEcho)
Sets if connection receives its own messages.
NATS_EXTERN natsStatus natsOptions_SetLameDuckModeCB(natsOptions *opts, natsConnectionHandler lameDuckCb, void *closure)
Sets the callback to be invoked when server enters lame duck mode.
NATS_EXTERN natsStatus natsOptions_SetCiphers(natsOptions *opts, const char *ciphers)
Sets the list of available ciphers.
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.
NATS_EXTERN natsStatus natsOptions_SetMessageBufferPadding(natsOptions *opts, int paddingSize)
Sets a custom padding when allocating buffer for incoming messages.
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.
NATS_EXTERN natsStatus natsOptions_SetUserCredentialsFromMemory(natsOptions *opts, const char *jwtAndSeedContent)
Sets JWT handler and handler to sign nonce that uses seed.
NATS_EXTERN natsStatus natsOptions_SetFlusherWaitMicros(natsOptions *opts, int64_t flusherWaitUs)
Sets the maximum time the flusher thread waits to accumulate data.
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.
NATS_EXTERN natsStatus natsOptions_Create(natsOptions **newOpts)
Creates a natsOptions object.
NATS_EXTERN natsStatus natsOptions_SetIgnoreAuthErrorAbort(natsOptions *opts, bool ignore)
Indicates if the connection should abort on authentication error or not.
NATS_EXTERN natsStatus natsOptions_SetNKeyFromSeed(natsOptions *opts, const char *pubKey, const char *seedFile)
Sets the NKey public key and its seed file.
NATS_EXTERN natsStatus natsOptions_AllowConcurrentTLSHandshakes(natsOptions *opts)
Allows concurrent TLS handshakes.
NATS_EXTERN natsStatus natsOptions_SkipServerVerification(natsOptions *opts, bool skip)
Switch server certificate verification.
NATS_EXTERN natsStatus natsOptions_UseOldRequestStyle(natsOptions *opts, bool useOldStyle)
Switches the use of old style requests.
NATS_EXTERN natsStatus natsOptions_SetMaxPendingBytes(natsOptions *opts, int64_t maxPending)
Sets the maximum number of pending bytes per subscription.
NATS_EXTERN natsStatus natsOptions_IPResolutionOrder(natsOptions *opts, int order)
Dictates the order in which host name are resolved during connect.
NATS_EXTERN natsStatus natsOptions_SetIgnoreDiscoveredServers(natsOptions *opts, bool ignore)
Sets if the library should ignore or not discovered servers.
NATS_EXTERN natsStatus natsOptions_LoadCATrustedCertificatesPath(natsOptions *opts, const char *path)
Loads the trusted CA certificates from a directory.
NATS_EXTERN natsStatus natsOptions_SetSendAsap(natsOptions *opts, bool sendAsap)
Sets if Publish calls should send data right away.
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.
NATS_EXTERN void natsOptions_Destroy(natsOptions *opts)
Destroys a natsOptions object.
NATS_EXTERN natsStatus natsOptions_SetMaxPendingMsgs(natsOptions *opts, int maxPending)
Sets the maximum number of pending messages per subscription.
NATS_EXTERN natsStatus natsOptions_SetReconnectBufSize(natsOptions *opts, int reconnectBufSize)
Sets the size of the backing buffer used during reconnect.
NATS_EXTERN natsStatus natsOptions_SetVerbose(natsOptions *opts, bool verbose)
Sets the verbose mode.
NATS_EXTERN natsStatus natsOptions_SetSecure(natsOptions *opts, bool secure)
Sets the secure mode.
NATS_EXTERN natsStatus natsOptions_LoadCertificatesChainDynamic(natsOptions *opts, const char *certsFileName, const char *keyFileName)
Loads the certificate chain and key from a file on every connection attempt.
NATS_EXTERN natsStatus natsOptions_SetNoRandomize(natsOptions *opts, bool noRandomize)
Indicate if the servers list should be randomized.
NATS_EXTERN natsStatus natsOptions_SetWriteDeadline(natsOptions *opts, int64_t deadline)
Sets the write deadline.
NATS_EXTERN natsStatus natsOptions_SetMaxPingsOut(natsOptions *opts, int maxPingsOut)
Sets the limit of outstanding PINGs without corresponding PONGs.
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.
NATS_EXTERN natsStatus natsOptions_SetMaxReconnect(natsOptions *opts, int maxReconnect)
Sets the maximum number of reconnect attempts.
NATS_EXTERN natsStatus natsOptions_SetDiscoveredServersCB(natsOptions *opts, natsConnectionHandler discoveredServersCb, void *closure)
Sets the callback to be invoked when new servers are discovered.
NATS_EXTERN natsStatus natsOptions_UseGlobalMessageDelivery(natsOptions *opts, bool global)
Switch on/off the use of a central message delivery thread pool.
NATS_EXTERN natsStatus natsOptions_SetCustomInboxPrefix(natsOptions *opts, const char *inboxPrefix)
Sets a custom inbox prefix.
NATS_EXTERN natsStatus natsOptions_TLSHandshakeFirst(natsOptions *opts)
Performs TLS handshake first.
NATS_EXTERN natsStatus natsOptions_SetServers(natsOptions *opts, const char **servers, int serversCount)
Set the list of servers to try to (re)connect to.
NATS_EXTERN natsStatus natsOptions_SetToken(natsOptions *opts, const char *token)
Sets the token to use when not specified in the URL.
NATS_EXTERN natsStatus natsOptions_SetProxyConnHandler(natsOptions *opts, natsProxyConnHandler proxyConnHandler, void *closure)
Sets the proxy connection handler.
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.
NATS_EXTERN natsStatus natsOptions_SetFailRequestsOnDisconnect(natsOptions *opts, bool failRequests)
Fails pending requests on disconnect event.
NATS_EXTERN natsStatus natsOptions_SetPingInterval(natsOptions *opts, int64_t interval)
Sets the ping interval.
NATS_EXTERN natsStatus natsOptions_SetCertificatesChain(natsOptions *opts, const char *cert, const char *key)
Sets the client certificate and key.
NATS_EXTERN natsStatus natsOptions_SetCATrustedCertificates(natsOptions *opts, const char *certificates)
Sets the trusted CA certificates from memory.
NATS_EXTERN natsStatus stanConnection_GetNATSConnection(stanConnection *sc, natsConnection **nc)
Returns the underlying NATS Connection.
NATS_EXTERN void stanConnection_ReleaseNATSConnection(stanConnection *sc)
Releases the NATS Connection.
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.
NATS_EXTERN natsStatus stanConnection_Close(stanConnection *sc)
Closes the connection.
NATS_EXTERN natsStatus stanConnection_Destroy(stanConnection *sc)
Destroys the connection object.
NATS_EXTERN natsStatus stanConnOptions_SetDiscoveryPrefix(stanConnOptions *opts, const char *prefix)
Sets the subject prefix the library sends the connect request to.
NATS_EXTERN natsStatus stanConnOptions_SetConnectionLostHandler(stanConnOptions *opts, stanConnectionLostHandler handler, void *closure)
Sets the connection lost handler.
NATS_EXTERN natsStatus stanConnOptions_SetMaxPubAcksInflight(stanConnOptions *opts, int maxPubAcksInflight, float percentage)
Sets the maximum number of published messages without outstanding ACKs from the server.
NATS_EXTERN natsStatus stanConnOptions_SetPubAckWait(stanConnOptions *opts, int64_t wait)
Sets the timeout for waiting for an ACK for a published message.
NATS_EXTERN natsStatus stanConnOptions_SetURL(stanConnOptions *opts, const char *url)
Sets the URL to connect to.
NATS_EXTERN natsStatus stanConnOptions_SetConnectionWait(stanConnOptions *opts, int64_t wait)
Sets the timeout for establishing a connection.
NATS_EXTERN void stanConnOptions_Destroy(stanConnOptions *opts)
Destroys a stanConnOptions object.
NATS_EXTERN natsStatus stanConnOptions_SetPings(stanConnOptions *opts, int interval, int maxOut)
Sets the ping interval and max out values.
NATS_EXTERN natsStatus stanConnOptions_SetNATSOptions(stanConnOptions *opts, natsOptions *nOpts)
Sets the NATS Options to use to create the connection.
NATS_EXTERN natsStatus stanConnOptions_Create(stanConnOptions **newOpts)
Creates a stanConnOptions object.
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.
NATS_EXTERN natsStatus stanConnection_Publish(stanConnection *sc, const char *channel, const void *data, int dataLen)
Publishes data on a channel.
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.
NATS_EXTERN natsStatus stanConnection_Subscribe(stanSubscription **sub, stanConnection *sc, const char *channel, stanMsgHandler cb, void *cbClosure, stanSubOptions *options)
Creates a subscription.
NATS_EXTERN const char * stanMsg_GetData(const stanMsg *msg)
Returns the message payload.
NATS_EXTERN int64_t stanMsg_GetTimestamp(const stanMsg *msg)
Returns the message's timestamp.
NATS_EXTERN int stanMsg_GetDataLength(const stanMsg *msg)
Returns the message length.
NATS_EXTERN bool stanMsg_IsRedelivered(const stanMsg *msg)
Returns the message's redelivered flag.
NATS_EXTERN uint64_t stanMsg_GetSequence(const stanMsg *msg)
Returns the message's sequence number.
NATS_EXTERN void stanMsg_Destroy(stanMsg *msg)
Destroys the message object.
NATS_EXTERN natsStatus stanSubscription_AckMsg(stanSubscription *sub, stanMsg *msg)
Acknowledge a message.
NATS_EXTERN void stanSubscription_Destroy(stanSubscription *sub)
Destroys the subscription.
NATS_EXTERN natsStatus stanSubscription_SetOnCompleteCB(stanSubscription *sub, natsOnCompleteCB cb, void *closure)
Sets a completion callback.
NATS_EXTERN natsStatus stanSubscription_Close(stanSubscription *sub)
Closes the subscription.
NATS_EXTERN natsStatus stanSubscription_Unsubscribe(stanSubscription *sub)
Permanently remove a subscription.
NATS_EXTERN void stanSubOptions_Destroy(stanSubOptions *opts)
Destroys a stanSubOptions object.
NATS_EXTERN natsStatus stanSubOptions_StartAtTimeDelta(stanSubOptions *opts, int64_t delta)
Sets the desired start position based on the given delta.
NATS_EXTERN natsStatus stanSubOptions_SetMaxInflight(stanSubOptions *opts, int maxInflight)
Sets the the maximum number of messages the cluster will send without an ACK.
NATS_EXTERN natsStatus stanSubOptions_StartAtSequence(stanSubOptions *opts, uint64_t seq)
Sets the desired start position based on the given sequence number.
NATS_EXTERN natsStatus stanSubOptions_SetManualAckMode(stanSubOptions *opts, bool manual)
Sets the subscription's acknowledgment mode.
NATS_EXTERN natsStatus stanSubOptions_StartWithLastReceived(stanSubOptions *opts)
The subscription should start with the last message in the channel.
NATS_EXTERN natsStatus stanSubOptions_SetDurableName(stanSubOptions *opts, const char *durableName)
Sets the Durable Name for this subscription.
NATS_EXTERN natsStatus stanSubOptions_StartAtTime(stanSubOptions *opts, int64_t time)
Sets the desired start position based on the given time.
NATS_EXTERN natsStatus stanSubOptions_DeliverAllAvailable(stanSubOptions *opts)
The subscription should start with the first message in the channel.
NATS_EXTERN natsStatus stanSubOptions_Create(stanSubOptions **newOpts)
Creates a stanSubOptions object.
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.
NATS_EXTERN void natsStatistics_Destroy(natsStatistics *stats)
Destroys the natsStatistics object.
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.
NATS_EXTERN natsStatus natsStatistics_Create(natsStatistics **newStats)
Creates a natsStatistics object.
NATS_EXTERN const char * natsStatus_GetText(natsStatus s)
Get the text corresponding to a natsStatus.
NATS_EXTERN natsStatus natsSubscription_WaitForDrainCompletion(natsSubscription *sub, int64_t timeout)
Blocks until the drain operation completes.
NATS_EXTERN natsStatus natsSubscription_AutoUnsubscribe(natsSubscription *sub, int max)
Auto-Unsubscribes.
NATS_EXTERN natsStatus natsSubscription_GetMaxPending(natsSubscription *sub, int *msgs, int *bytes)
Returns the maximum number of pending messages and bytes.
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.
NATS_EXTERN natsStatus natsSubscription_GetDropped(natsSubscription *sub, int64_t *msgs)
Returns the number of dropped messages.
NATS_EXTERN natsStatus natsSubscription_Drain(natsSubscription *sub)
Drains the subscription with a default timeout.
NATS_EXTERN natsStatus natsSubscription_NoDeliveryDelay(natsSubscription *sub)
Enables the No Delivery Delay mode.
NATS_EXTERN natsStatus natsSubscription_GetDelivered(natsSubscription *sub, int64_t *msgs)
Returns the number of delivered messages.
NATS_EXTERN void natsSubscription_Destroy(natsSubscription *sub)
Destroys the subscription.
NATS_EXTERN int64_t natsSubscription_GetID(natsSubscription *sub)
Gets the subscription id.
NATS_EXTERN bool natsSubscription_IsValid(natsSubscription *sub)
Checks the validity of the subscription.
NATS_EXTERN natsStatus natsSubscription_NextMsg(natsMsg **nextMsg, natsSubscription *sub, int64_t timeout)
Returns the next available message.
NATS_EXTERN natsStatus natsSubscription_SetPendingLimits(natsSubscription *sub, int msgLimit, int bytesLimit)
Sets the limit for pending messages and bytes.
NATS_EXTERN natsConnection * natsSubscription_GetConnection(natsSubscription *sub)
Returns the connection that created this subscription.
NATS_EXTERN natsStatus natsSubscription_GetPendingLimits(natsSubscription *sub, int *msgLimit, int *bytesLimit)
Returns the current limit for pending messages and bytes.
NATS_EXTERN natsStatus natsSubscription_QueuedMsgs(natsSubscription *sub, uint64_t *queuedMsgs)
Gets the number of pending messages.
NATS_EXTERN natsStatus natsSubscription_DrainCompletionStatus(natsSubscription *sub)
Returns the status of the drain after completion.
NATS_EXTERN natsStatus natsSubscription_DrainTimeout(natsSubscription *sub, int64_t timeout)
Drains the subscription with the specified timeout.
NATS_EXTERN natsStatus natsSubscription_GetPending(natsSubscription *sub, int *msgs, int *bytes)
Returns the number of pending messages and bytes.
NATS_EXTERN const char * natsSubscription_GetSubject(natsSubscription *sub)
Gets the subject name.
NATS_EXTERN natsStatus natsSubscription_SetOnCompleteCB(natsSubscription *sub, natsOnCompleteCB cb, void *closure)
Sets a completion callback.
NATS_EXTERN natsStatus natsSubscription_Unsubscribe(natsSubscription *sub)
Unsubscribes.
NATS_EXTERN natsStatus natsSubscription_ClearMaxPending(natsSubscription *sub)
Clears the statistics regarding the maximum pending values.
struct __objStorePut objStorePut
Definition nats.h:1793
struct __stanSubOptions stanSubOptions
Way to configure a stanSubscription.
Definition nats.h:2222
struct __kvStore kvStore
Definition nats.h:1555
jsPersistModeType
Definition nats.h:420
struct __objStore objStore
Definition nats.h:1779
jsStorageCompression
Definition nats.h:375
jsDeliverPolicy
Definition nats.h:384
struct __stanConnOptions stanConnOptions
Way to configure a stanConnection.
Definition nats.h:2216
jsStorageType
Definition nats.h:365
char natsInbox
Unique subject often used for point-to-point communication.
Definition nats.h:187
struct __stanMsg stanMsg
The Streaming message.
Definition nats.h:2210
jsRetentionPolicy
Definition nats.h:344
struct __kvWatcher kvWatcher
Definition nats.h:1570
struct __natsStatistics natsStatistics
Statistics of a natsConnection.
Definition nats.h:159
bool(* jsFetchNextHandler)(int *messages, int64_t *maxBytes, natsSubscription *sub, void *closure)
Callback used to customize flow control for js_PullSubscribeAsync.
Definition nats.h:1388
jsDiscardPolicy
Definition nats.h:355
jsReplayPolicy
Definition nats.h:410
struct __natsSubscription natsSubscription
Interest on a given subject.
Definition nats.h:165
kvOperation
Definition nats.h:1576
jsAckPolicy
Definition nats.h:398
struct __stanConnection stanConnection
A connection to a NATS Streaming Server.
Definition nats.h:2198
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:1376
struct __jsAtomicBatchCtx jsAtomicBatchCtx
Definition nats.h:286
struct __jsCtx jsCtx
Definition nats.h:281
struct __natsOptions natsOptions
Way to configure a natsConnection.
Definition nats.h:178
struct __natsHeader natsHeader
Map with key being a string and value being an array of strings.
Definition nats.h:193
struct __objStoreGet objStoreGet
Definition nats.h:1800
struct __natsClientConfig natsClientConfig
An initial configuration for NATS client. Provides control over the threading model,...
struct __kvStatus kvStatus
Definition nats.h:1565
struct __kvEntry kvEntry
Definition nats.h:1560
struct __natsMsg natsMsg
A structure holding a subject, optional reply and payload.
Definition nats.h:172
struct __objStoreWatcher objStoreWatcher
Definition nats.h:1805
struct __stanSubscription stanSubscription
Interest on a given channel.
Definition nats.h:2204
struct __natsConnection natsConnection
A connection to a NATS Server.
Definition nats.h:152
@ js_PersistDefault
Writes are immediately flushed, acknowledgement sent after message is stored.
Definition nats.h:421
@ js_PersistAsync
Writes are flushed asynchronously, acknowledgement may be sent before message is stored.
Definition nats.h:422
@ js_StorageCompressionNone
Specifies no compression. It's the default.
Definition nats.h:376
@ js_StorageCompressionS2
Specifies S2.
Definition nats.h:377
@ js_DeliverByStartSequence
Starts from a given sequence.
Definition nats.h:388
@ js_DeliverByStartTime
Starts from a given UTC time (number of nanoseconds since epoch)
Definition nats.h:389
@ js_DeliverNew
Starts with messages sent after the consumer is created.
Definition nats.h:387
@ js_DeliverLastPerSubject
Starts with the last message for all subjects received.
Definition nats.h:390
@ js_DeliverLast
Starts with the last sequence received.
Definition nats.h:386
@ js_DeliverAll
Starts from the very beginning of a stream. This is the default.
Definition nats.h:385
@ js_FileStorage
Specifies on disk storage. It's the default.
Definition nats.h:366
@ js_MemoryStorage
Specifies in memory only.
Definition nats.h:367
@ js_LimitsPolicy
Specifies that messages are retained until any given limit is reached, which could be one of MaxMsgs,...
Definition nats.h:345
@ js_InterestPolicy
Specifies that when all known observables have acknowledged a message it can be removed.
Definition nats.h:346
@ js_WorkQueuePolicy
Specifies that when the first worker or subscriber acknowledges the message it can be removed.
Definition nats.h:347
@ js_DiscardNew
Will fail to store new messages.
Definition nats.h:357
@ js_DiscardOld
Will remove older messages to return to the limits. This is the default.
Definition nats.h:356
@ js_ReplayInstant
Replays messages as fast as possible.
Definition nats.h:411
@ js_ReplayOriginal
Maintains the same timing as the messages were received.
Definition nats.h:412
@ kvOp_Unknown
Definition nats.h:1577
@ kvOp_Delete
Definition nats.h:1579
@ kvOp_Put
Definition nats.h:1578
@ kvOp_Purge
Definition nats.h:1580
@ js_AckExplicit
Requires ack or nack for all messages.
Definition nats.h:399
@ js_AckAll
When acking a sequence number, this implicitly acks all sequences below this one as well.
Definition nats.h:401
@ js_AckNone
Requires no acks for delivered messages.
Definition nats.h:400
#define NATS_EXTERN
Needed for shared library.
Definition nats.h:49
int natsSock
Definition nats.h:50
jsErrCode
Definition status.h:146
natsStatus
Status returned by most of the APIs.
Definition status.h:50
natsConnStatus
The connection state.
Definition status.h:24
An initial configuration for NATS client. Provides control over the threading model,...
Definition nats.h:206
bool DefaultRepliesToThreadPool
Definition nats.h:216
bool UseSeparatePoolForReplies
Definition nats.h:217
int ReplyThreadPoolMax
Definition nats.h:218
int ThreadPoolMax
Definition nats.h:213
natsThreadStartedHandler ThreadStartedHandler
Definition nats.h:221
int64_t DefaultWriteDeadline
Definition nats.h:207
bool DefaultToThreadPool
Definition nats.h:212
int64_t LockSpinCount
Definition nats.h:209
void * ThreadStartedHandlerClosure
Definition nats.h:222
Definition nats.h:1209
uint64_t Total
Definition nats.h:1210
uint64_t Errors
Definition nats.h:1211
Definition nats.h:1246
int64_t Consumers
Definition nats.h:1250
int64_t Streams
Definition nats.h:1249
int TiersLen
Definition nats.h:1255
uint64_t Memory
Definition nats.h:1247
jsAPIStats API
Definition nats.h:1252
jsAccountLimits Limits
Definition nats.h:1253
jsTier ** Tiers
Definition nats.h:1254
char * Domain
Definition nats.h:1251
uint64_t Store
Definition nats.h:1248
Definition nats.h:1219
int64_t MemoryMaxStreamBytes
Definition nats.h:1225
int64_t MaxStreams
Definition nats.h:1222
int64_t MaxAckPending
Definition nats.h:1224
int64_t MaxConsumers
Definition nats.h:1223
int64_t MaxStore
Definition nats.h:1221
int64_t MaxMemory
Definition nats.h:1220
bool MaxBytesRequired
Definition nats.h:1227
int64_t StoreMaxStreamBytes
Definition nats.h:1226
Definition nats.h:794
int ReplicasLen
Definition nats.h:798
char * Name
Definition nats.h:795
char * TrafficAcc
Definition nats.h:802
char * RaftGroup
Definition nats.h:799
jsPeerInfo ** Replicas
Definition nats.h:797
int64_t LeaderSince
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:800
bool SystemAcc
Definition nats.h:801
char * Leader
Definition nats.h:796
Definition nats.h:924
int PriorityGroupsLen
Definition nats.h:989
bool MemoryStorage
Definition nats.h:961
const char * PriorityPolicy
Represents the priority policy the consumer is set to. Must be "pinned_client" or "overflow"....
Definition nats.h:979
const char * Name
Definition nats.h:925
int FilterSubjectsLen
Definition nats.h:966
uint64_t OptStartSeq
Definition nats.h:929
bool HeadersOnly
Definition nats.h:944
uint64_t RateLimit
Definition nats.h:938
jsDeliverPolicy DeliverPolicy
Definition nats.h:928
const char * Description
Definition nats.h:927
const char * Durable
Definition nats.h:926
const char * SampleFrequency
Definition nats.h:939
bool FlowControl
Definition nats.h:942
int64_t MaxRequestBatch
Maximum Pull Consumer request batch size.
Definition nats.h:947
int64_t AckWait
Definition nats.h:932
int64_t MaxRequestMaxBytes
Maximum Pull Consumer request maximum bytes.
Definition nats.h:949
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:930
int64_t MaxWaiting
Definition nats.h:940
jsAckPolicy AckPolicy
Definition nats.h:931
natsMetadata Metadata
User-provided metadata for the consumer, encoded as an array of {"key", "value",.....
Definition nats.h:967
const char * DeliverSubject
Definition nats.h:952
const char ** PriorityGroups
The list of priority groups this consumer supports.
Definition nats.h:988
int64_t PinnedTTL
PinnedTTL represents the time after which the client will be unpinned if no new pull requests are sen...
Definition nats.h:985
int64_t * BackOff
Redelivery durations expressed in nanoseconds.
Definition nats.h:934
int64_t MaxRequestExpires
Maximum Pull Consumer request expiration, expressed in number of nanoseconds.
Definition nats.h:948
int64_t Heartbeat
Heartbeat interval expressed in number of nanoseconds.
Definition nats.h:943
int64_t PauseUntil
Suspends the consumer until this deadline, represented as number of nanoseconds since epoch....
Definition nats.h:974
int64_t Replicas
Definition nats.h:959
int BackOffLen
Definition nats.h:935
int64_t MaxDeliver
Definition nats.h:933
const char ** FilterSubjects
Multiple filter subjects.
Definition nats.h:965
jsReplayPolicy ReplayPolicy
Definition nats.h:937
const char * DeliverGroup
Definition nats.h:953
int64_t MaxAckPending
Definition nats.h:941
const char * FilterSubject
Definition nats.h:936
int64_t InactiveThreshold
How long the server keeps an ephemeral after detecting loss of interest, expressed in number of nanos...
Definition nats.h:956
Definition nats.h:1132
bool Paused
Definition nats.h:1145
jsSequenceInfo Delivered
Definition nats.h:1137
jsPriorityGroupState * PriorityGroups
Priority groups for the (pull) consumer.
Definition nats.h:1147
jsConsumerConfig * Config
Definition nats.h:1136
bool PushBound
Definition nats.h:1144
int64_t NumWaiting
Definition nats.h:1141
int PriorityGroupsLen
Number of priority groups.
Definition nats.h:1148
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1135
jsClusterInfo * Cluster
Definition nats.h:1143
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition nats.h:1146
int64_t NumAckPending
Definition nats.h:1139
char * Stream
Definition nats.h:1133
int64_t NumRedelivered
Definition nats.h:1140
char * Name
Definition nats.h:1134
jsSequenceInfo AckFloor
Definition nats.h:1138
uint64_t NumPending
Definition nats.h:1142
Definition nats.h:1159
jsConsumerInfo ** List
Definition nats.h:1160
int Count
Definition nats.h:1161
Definition nats.h:1173
int Count
Definition nats.h:1175
char ** List
Definition nats.h:1174
Definition nats.h:1185
int64_t PauseRemaining
Remaining time in nanoseconds.
Definition nats.h:1188
bool Paused
Definition nats.h:1186
int64_t PauseUntil
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1187
Definition nats.h:1199
uint64_t ResetSeq
Stream sequence the consumer was reset to.
Definition nats.h:1201
jsConsumerInfo * Consumer
Consumer info after the reset.
Definition nats.h:1200
Definition nats.h:1010
uint64_t Stream
This is the stream sequence that the application should resume from.
Definition nats.h:1011
uint64_t ConsumerServer
This is the consumer sequence last sent by the server.
Definition nats.h:1013
uint64_t ConsumerClient
This is the consumer sequence that was last received by the library.
Definition nats.h:1012
Definition nats.h:1322
const char * NextBySubject
Get the next message (based on sequence) for that subject.
Definition nats.h:1324
uint64_t Sequence
Get the message at this sequence.
Definition nats.h:1323
const char * LastBySubject
Get the last message on that subject.
Definition nats.h:1325
Definition nats.h:454
const char * DeliverPrefix
Definition nats.h:456
const char * APIPrefix
Definition nats.h:455
Definition nats.h:1335
const char * ID
Definition nats.h:1345
const char * Group
Definition nats.h:1347
int64_t MaxBytes
Maximum bytes for the request (request complete based on whichever Batch or MaxBytes comes first)
Definition nats.h:1338
int64_t MinPending
Definition nats.h:1343
uint8_t Priority
Definition nats.h:1349
int Batch
Maximum number of messages to be received (see MaxBytes)
Definition nats.h:1337
int64_t MinAckPending
Definition nats.h:1344
int64_t Expires
Expiration of the request, expressed in nanoseconds.
Definition nats.h:1336
bool NoWait
Will not wait if the request cannot be completed.
Definition nats.h:1339
int64_t Heartbeat
Have server sends heartbeats to help detect communication failures.
Definition nats.h:1340
Definition nats.h:696
uint64_t * Msgs
Definition nats.h:697
uint64_t Bytes
Definition nats.h:699
int MsgsLen
Definition nats.h:698
Definition nats.h:1267
uint64_t NumPending
Definition nats.h:1270
jsSequencePair Sequence
Definition nats.h:1268
char * Stream
Definition nats.h:1272
char * Domain
Definition nats.h:1274
char * Consumer
Definition nats.h:1273
uint64_t NumDelivered
Definition nats.h:1269
int64_t Timestamp
Definition nats.h:1271
Definition nats.h:1542
jsOptionsPullSubscribeAsync PullSubscribeAsync
extra options for js_PullSubscribeAsync
Definition nats.h:1547
int64_t Wait
Amount of time (in milliseconds) to wait for various JetStream API requests, default is 5000 ms (5 se...
Definition nats.h:1545
jsOptionsPublishAsync PublishAsync
extra options for js_PublishAsync
Definition nats.h:1546
const char * Prefix
JetStream prefix, default is "$JS.API".
Definition nats.h:1543
jsOptionsStream Stream
Optional stream options.
Definition nats.h:1548
const char * Domain
Domain changes the domain part of JetSteam API prefix.
Definition nats.h:1544
Definition nats.h:1469
int64_t MaxPending
Maximum outstanding asynchronous publishes that can be inflight at one time.
Definition nats.h:1470
void * AckHandlerClosure
Closure (or user data) passed to jsPubAckHandler callback.
Definition nats.h:1478
bool MuxReplies
Definition nats.h:1489
jsPubAckHandler AckHandler
Callback invoked for each asynchronous published message.
Definition nats.h:1477
jsPubAckErrHandler ErrHandler
Callback invoked when error encountered publishing a given message.
Definition nats.h:1484
void * ErrHandlerClosure
Closure (or user data) passed to jsPubAckErrHandler callback.
Definition nats.h:1485
int64_t StallWait
Amount of time (in milliseconds) to wait in a PublishAsync call when there is MaxPending inflight mes...
Definition nats.h:1487
Definition nats.h:1396
int64_t MaxBytes
Auto-unsubscribe after receiving this many bytes.
Definition nats.h:1399
int FetchSize
When using the automatic Fetch flow control (default NextHandler), this is the number of messages to ...
Definition nats.h:1443
void * NextHandlerClosure
Definition nats.h:1459
int MaxMessages
Auto-unsubscribed after receiving this many messages.
Definition nats.h:1398
int64_t Timeout
Auto-unsubsribe after this many milliseconds.
Definition nats.h:1397
jsFetchNextHandler NextHandler
If set, switches to manual fetch flow control.
Definition nats.h:1458
int64_t MinAckPending
When specified, this Pull request will only receive messages when the consumer has at least this many...
Definition nats.h:1438
jsFetchCompleteHandler CompleteHandler
Fetch complete handler that receives the exit status code, the subscription's Complete handler is als...
Definition nats.h:1413
int64_t Heartbeat
Have server sends heartbeats at this interval (in milliseconds) to help detect communication failures...
Definition nats.h:1418
bool NoWait
If NoWait is set, the subscription will receive the messages already stored on the server subject to ...
Definition nats.h:1408
void * CompleteHandlerClosure
Definition nats.h:1414
int64_t MinPending
When specified, this subscription will only receive messages when the consumer has at least this many...
Definition nats.h:1431
const char * Group
The name of consumer priority group.
Definition nats.h:1424
int KeepAhead
When using the automatic Fetch flow control (default NextHandler), initiate the next fetch request (t...
Definition nats.h:1451
Definition nats.h:1530
jsOptionsStreamInfo Info
Optional stream information retrieval options.
Definition nats.h:1532
jsOptionsStreamPurge Purge
Optional stream purge options.
Definition nats.h:1531
Definition nats.h:1517
bool DeletedDetails
Get the list of deleted message sequences.
Definition nats.h:1518
const char * SubjectsFilter
Get the list of subjects in this stream.
Definition nats.h:1519
Definition nats.h:1506
uint64_t Keep
Number of messages to keep.
Definition nats.h:1509
const char * Subject
This is the subject to match against messages for the purge command.
Definition nats.h:1507
uint64_t Sequence
Purge up to but not including sequence.
Definition nats.h:1508
Definition nats.h:780
bool Offline
Definition nats.h:783
uint64_t Lag
Definition nats.h:785
int64_t Active
Definition nats.h:784
char * Name
Definition nats.h:781
bool Current
Definition nats.h:782
Definition nats.h:437
int TagsLen
Definition nats.h:440
const char * Cluster
Definition nats.h:438
const char ** Tags
Definition nats.h:439
Definition nats.h:1119
char * Group
Definition nats.h:1120
char * PinnedClientID
Definition nats.h:1121
int64_t PinnedTS
Definition nats.h:1122
Definition nats.h:1298
natsMsg * Msg
Definition nats.h:1299
natsStatus Err
Definition nats.h:1300
jsErrCode ErrCode
Definition nats.h:1301
const char * ErrText
Definition nats.h:1302
Definition nats.h:1282
uint64_t Sequence
Definition nats.h:1284
bool Duplicate
Definition nats.h:1286
char * Domain
Definition nats.h:1285
char * Value
Definition nats.h:1289
char * Stream
Definition nats.h:1283
uint64_t Count
Definition nats.h:1288
char * Batch
Definition nats.h:1287
Definition nats.h:325
int64_t MsgTTL
Message time to live (TTL) in milliseconds, used by the server to expire the message....
Definition nats.h:334
const char * ExpectLastMsgId
Expected last message ID in the stream.
Definition nats.h:329
int64_t MaxWait
Amount of time (in milliseconds) to wait for a publish response, default will the context's Wait valu...
Definition nats.h:326
uint64_t ExpectLastSeq
Expected last message sequence in the stream.
Definition nats.h:330
bool ExpectNoMessage
Expected no message (that is, sequence == 0) for the subject in the stream.
Definition nats.h:333
const char * ExpectLastSubjectSeqSubject
Expected subject for the sequence set with 'ExpectLastSubjectSeq'.
Definition nats.h:332
const char * ExpectStream
Expected stream to respond from the publish call.
Definition nats.h:328
const char * MsgId
Message ID used for de-duplication.
Definition nats.h:327
jsScheduleOptions Schedule
Definition nats.h:335
uint64_t ExpectLastSubjectSeq
Expected last message sequence for the subject in the stream.
Definition nats.h:331
Definition nats.h:490
bool HeadersOnly
Definition nats.h:493
const char * Source
Definition nats.h:491
const char * Destination
Definition nats.h:492
Definition nats.h:293
const char * Target
The subject the message will be delivered to.
Definition nats.h:297
bool Rollup
When publishing sets a Rollup on the message.
Definition nats.h:304
const char * CancelScheduledSubject
Subject of scheduled message to be canceled.
Definition nats.h:305
int64_t TTL
When publishing sets a TTL (in milliseconds) on the message if the stream supports per message TTLs.
Definition nats.h:301
const char * Source
Definition nats.h:298
const char * TimeZone
Definition nats.h:302
const char * Schedule
Definition nats.h:294
Definition nats.h:1108
int64_t Last
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:1111
uint64_t Stream
Definition nats.h:1110
uint64_t Consumer
Definition nats.h:1109
Definition nats.h:1098
uint64_t Consumer
Definition nats.h:1099
uint64_t Stream
Definition nats.h:1100
Definition nats.h:825
const char * Name
Definition nats.h:826
const char * Cluster
Definition nats.h:828
const char * Domain
Definition nats.h:827
Definition nats.h:596
jsDiscardPolicy Discard
Definition nats.h:608
const char ** Subjects
Definition nats.h:599
jsSubjectTransformConfig SubjectTransform
Applies a subject transform (to matching messages) before doing anything else when a new message is r...
Definition nats.h:656
bool AllowBatched
Allow batch publishing of messages into the stream. Requires nats-server v2.14.0 or later.
Definition nats.h:688
bool AllowDirect
Allow higher performance, direct access to get individual messages. E.g. KeyValue.
Definition nats.h:632
int SourcesLen
Definition nats.h:617
bool DiscardNewPerSubject
Allow KV like semantics to also discard new on a per subject basis.
Definition nats.h:640
jsStorageCompression Compression
js_StorageCompressionNone (default) or js_StorageCompressionS2.
Definition nats.h:649
const char * Description
Definition nats.h:598
const char * Template
Definition nats.h:612
jsPersistModeType PersistMode
Sets the persistence mode for the stream. Requires nats-server v2.12.0 or later.
Definition nats.h:673
bool AllowMsgTTL
Allow the message to be sent with a time to live (TTL) value. Requires nats-server v2....
Definition nats.h:664
bool DenyPurge
Restrict the ability to purge messages.
Definition nats.h:620
jsStorageType Storage
Definition nats.h:609
jsStreamConsumerLimits ConsumerLimits
Sets the limits on certain options on all consumers of the stream.
Definition nats.h:660
jsRetentionPolicy Retention
Definition nats.h:601
int64_t MaxMsgs
Definition nats.h:603
int64_t MaxConsumers
Definition nats.h:602
natsMetadata Metadata
A user-provided array of key/value pairs, encoded as a string array [n1, v1, n2, v2,...
Definition nats.h:645
uint64_t FirstSeq
the starting sequence number for the stream.
Definition nats.h:652
const char * Name
Definition nats.h:597
bool AllowMsgCounter
Allow the message counter to be used for the stream. Requires nats-server v2.12.0 or later.
Definition nats.h:680
bool NoAck
Definition nats.h:611
jsStreamSource ** Sources
Definition nats.h:616
int32_t MaxMsgSize
Definition nats.h:607
jsRePublish * RePublish
Allow republish of the message after being sequenced and stored.
Definition nats.h:628
bool MirrorDirect
Allow higher performance and unified direct access for mirrors as well.
Definition nats.h:636
int64_t Duplicates
Definition nats.h:613
int64_t MaxMsgsPerSubject
Definition nats.h:606
int64_t SubjectDeleteMarkerTTL
Enables and sets a duration for adding server markers for delete, purge and max age limits....
Definition nats.h:669
int64_t MaxAge
Max age of messages in nanoseconds.
Definition nats.h:605
bool AllowAtomic
Enables sending atomic batch publishing into the stream.
Definition nats.h:676
int SubjectsLen
Definition nats.h:600
bool AllowRollup
Allow messages to be placed into the system and purge all older messages using a special message head...
Definition nats.h:624
jsStreamSource * Mirror
Definition nats.h:615
jsPlacement * Placement
Definition nats.h:614
int64_t MaxBytes
Definition nats.h:604
int64_t Replicas
Definition nats.h:610
bool Sealed
Seal a stream so no messages can get our or in.
Definition nats.h:618
bool DenyDelete
Restrict the ability to delete messages.
Definition nats.h:619
bool AllowMsgSchedules
Allow messages to be scheduled in the stream. Requires nats-server v2.14.0 or later.
Definition nats.h:684
Definition nats.h:512
int MaxAckPending
Definition nats.h:514
int64_t InactiveThreshold
Definition nats.h:513
Definition nats.h:839
jsStreamSourceInfo ** Sources
Definition nats.h:845
int64_t Created
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:841
jsStreamAlternate ** Alternates
Definition nats.h:847
jsStreamState State
Definition nats.h:842
jsClusterInfo * Cluster
Definition nats.h:843
jsStreamSourceInfo * Mirror
Definition nats.h:844
int AlternatesLen
Definition nats.h:848
jsStreamConfig * Config
Definition nats.h:840
int SourcesLen
Definition nats.h:846
Definition nats.h:860
jsStreamInfo ** List
Definition nats.h:861
int Count
Definition nats.h:862
Definition nats.h:874
char ** List
Definition nats.h:875
int Count
Definition nats.h:876
Definition nats.h:473
jsExternalStream * External
Definition nats.h:478
int64_t OptStartTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:476
const char * Name
Definition nats.h:474
const char * Domain
Definition nats.h:482
uint64_t OptStartSeq
Definition nats.h:475
const char * FilterSubject
Definition nats.h:477
Definition nats.h:810
const char * FilterSubject
Definition nats.h:815
int64_t Active
Definition nats.h:814
int SubjectTransformsLen
Definition nats.h:817
char * Name
Definition nats.h:811
jsExternalStream * External
Definition nats.h:812
uint64_t Lag
Definition nats.h:813
jsSubjectTransformConfig * SubjectTransforms
Definition nats.h:816
Definition nats.h:758
jsLostStreamData * Lost
Definition nats.h:770
uint64_t LastSeq
Definition nats.h:763
int64_t Consumers
Definition nats.h:771
int DeletedLen
Definition nats.h:769
uint64_t Msgs
Definition nats.h:759
jsStreamStateSubjects * Subjects
Definition nats.h:766
uint64_t FirstSeq
Definition nats.h:761
int64_t LastTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:764
int64_t NumSubjects
Definition nats.h:765
uint64_t * Deleted
Definition nats.h:768
uint64_t NumDeleted
Definition nats.h:767
uint64_t Bytes
Definition nats.h:760
int64_t FirstTime
UTC time expressed as number of nanoseconds since epoch.
Definition nats.h:762
Definition nats.h:709
uint64_t Msgs
Definition nats.h:711
const char * Subject
Definition nats.h:710
Definition nats.h:745
int Count
Definition nats.h:747
jsStreamStateSubject * List
Definition nats.h:746
Definition nats.h:1033
bool ManualAck
If true, the user will have to acknowledge the messages.
Definition nats.h:1078
const char * Consumer
If specified, the subscription will be bound to an existing consumer from the Stream without attempti...
Definition nats.h:1050
const char * Stream
If specified, the consumer will be bound to this stream name.
Definition nats.h:1040
bool Ordered
If true, this will be an ordered consumer.
Definition nats.h:1090
const char * Queue
Queue name for queue subscriptions.
Definition nats.h:1065
jsConsumerConfig Config
Consumer configuration.
Definition nats.h:1083
Definition nats.h:502
const char * Destination
Definition nats.h:504
const char * Source
Definition nats.h:503
Definition nats.h:1232
const char * Name
Definition nats.h:1233
int64_t Streams
Definition nats.h:1236
uint64_t Store
Definition nats.h:1235
int64_t Consumers
Definition nats.h:1237
uint64_t Memory
Definition nats.h:1234
jsAccountLimits Limits
Definition nats.h:1238
Definition nats.h:1590
uint8_t History
Definition nats.h:1594
const char * Bucket
Definition nats.h:1591
int64_t MaxBytes
Definition nats.h:1596
int32_t MaxValueSize
Definition nats.h:1593
int Replicas
Definition nats.h:1598
const char * Description
Definition nats.h:1592
int64_t LimitMarkerTTL
Definition nats.h:1608
jsStreamSource * Mirror
Definition nats.h:1600
int64_t TTL
Definition nats.h:1595
jsStorageType StorageType
Definition nats.h:1597
jsRePublish * RePublish
Definition nats.h:1599
int SourcesLen
Definition nats.h:1602
jsStreamSource ** Sources
Definition nats.h:1601
A list of KeyValue store entries.
Definition nats.h:1746
kvEntry ** Entries
Definition nats.h:1747
int Count
Definition nats.h:1748
A list of KeyValue store keys.
Definition nats.h:1770
int Count
Definition nats.h:1772
char ** Keys
Definition nats.h:1771
Definition nats.h:1704
int64_t TTL
Definition nats.h:1724
int64_t Timeout
Definition nats.h:1706
int64_t DeleteMarkersOlderThan
Definition nats.h:1716
Definition nats.h:1623
bool IgnoreDeletes
Do not receive delete markers.
Definition nats.h:1628
bool IncludeHistory
Receive all history per subject, not just the last one.
Definition nats.h:1636
uint64_t ResumeFromRevision
Resume from this specific revision.
Definition nats.h:1679
void * Closure
An optional pointer to user provided data to be passed to the Callback.
Definition nats.h:1694
int64_t Timeout
How long to wait for some operations to complete.
Definition nats.h:1648
bool UpdatesOnly
Only receive updates, no initial snapshot.
Definition nats.h:1659
int64_t Heartbeat
Heartbeat used by the internal ordered consumer.
Definition nats.h:1667
bool MetaOnly
Only receive the meta data of the entry.
Definition nats.h:1642
kvWatchCb Callback
This callback is invoked when an entry is available.
Definition nats.h:1687
Definition nats.h:10370
const char * Name
The name of the endpoint.
Definition nats.h:10376
microRequestHandler Handler
The request handler for the endpoint.
Definition nats.h:10410
const char * Subject
The NATS subject the endpoint will listen on.
Definition nats.h:10387
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:10405
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:10399
const char * QueueGroup
Overrides the default queue group for the service.
Definition nats.h:10393
void * State
A user-provided pointer to store with the endpoint (state/closure).
Definition nats.h:10416
Definition nats.h:10423
const char * Subject
The semantic version of the service.
Definition nats.h:10432
const char * Name
The name of the service.
Definition nats.h:10427
const char * QueueGroup
Endpoint's actual queue group (the default "q", or one explicitly set by the user),...
Definition nats.h:10438
natsMetadata Metadata
Metadata for the endpoint, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:10444
Definition nats.h:10451
const char * Subject
Definition nats.h:10453
int64_t NumRequests
The number of requests received by the endpoint.
Definition nats.h:10464
char LastErrorString[2048]
a copy of the last error message.
Definition nats.h:10490
int64_t ProcessingTimeSeconds
total request processing time (the seconds part).
Definition nats.h:10475
int64_t ProcessingTimeNanoseconds
total request processing time (the nanoseconds part).
Definition nats.h:10480
const char * QueueGroup
Endpoint's actual queue group (the default "q", or one explicitly set by the user),...
Definition nats.h:10459
int64_t NumErrors
The number of errors, service-level and internal, associated with the endpoint.
Definition nats.h:10470
int64_t AverageProcessingTimeNanoseconds
average request processing time, in ns.
Definition nats.h:10485
const char * Name
Definition nats.h:10452
The Microservice endpoint group configuration object.
Definition nats.h:10497
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:10505
const char * QueueGroup
Overrides the default queue group for the service.
Definition nats.h:10502
const char * Prefix
The subject prefix for the group.
Definition nats.h:10499
The Microservice top-level configuration object.
Definition nats.h:10515
const char * Description
The description of the service.
Definition nats.h:10531
void * State
A user-provided pointer to state data.
Definition nats.h:10595
const char * Version
The (semantic) version of the service.
Definition nats.h:10526
microErrorHandler ErrHandler
An error notification handler.
Definition nats.h:10576
natsMetadata Metadata
Immutable metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:10549
bool NoQueueGroup
Disables the use of a queue group for the service.
Definition nats.h:10543
microRequestHandler StatsHandler
A custom stats handler.
Definition nats.h:10567
microDoneHandler DoneHandler
A callback handler for handling the final cleanup Done event, right before the service is destroyed.
Definition nats.h:10586
const char * QueueGroup
Overrides the default queue group for the service ("q").
Definition nats.h:10537
const char * Name
The name of the service.
Definition nats.h:10521
microEndpointConfig * Endpoint
The "main" (aka default) endpoint configuration.
Definition nats.h:10558
Definition nats.h:10604
natsMetadata Metadata
Metadata for the service, a JSON-encoded user-provided object, e.g. {"key":"value"}
Definition nats.h:10633
const char * Name
The name of the service.
Definition nats.h:10613
const char * Version
The semantic version of the service.
Definition nats.h:10618
const char * Type
Response type. Always "io.nats.micro.v1.info_response".
Definition nats.h:10608
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:10628
microEndpointInfo * Endpoints
Endpoints.
Definition nats.h:10638
const char * Description
The description of the service.
Definition nats.h:10623
int EndpointsLen
The number of endpoints in the Endpoints array.
Definition nats.h:10643
Definition nats.h:10650
int64_t Started
The timestamp of when the service was started.
Definition nats.h:10674
int EndpointsLen
The number of endpoints in the endpoints array.
Definition nats.h:10684
microEndpointStats * Endpoints
The stats for each endpoint of the service.
Definition nats.h:10679
const char * Version
The semantic version of the service.
Definition nats.h:10664
const char * Name
The name of the service.
Definition nats.h:10659
const char * Type
Response type. Always "io.nats.micro.v1.stats_response".
Definition nats.h:10654
const char * Id
The ID of the service instance responding to the request.
Definition nats.h:10669
A type to represent user-provided metadata, a list of k=v pairs.
Definition nats.h:261
int Count
Number of key/value pairs in Metadata, 1/2 of the length of the array.
Definition nats.h:269
const char ** List
User-provided metadata for the stream, encoded as an array of {"key", "value",...}.
Definition nats.h:265
A list of NATS messages.
Definition nats.h:250
int Count
Definition nats.h:252
natsMsg ** Msgs
Definition nats.h:251
Definition nats.h:1835
natsMetadata Metadata
Bucket-specific metadata.
Definition nats.h:1898
int64_t TTL
TTL is the maximum age (expressed in milliseconds) of objects in the store.
Definition nats.h:1855
jsStorageType Storage
Storage is the type of storage to use for the object store.
Definition nats.h:1869
int Replicas
Replicas is the number of replicas to keep for the object store in clustered jetstream.
Definition nats.h:1876
bool Compression
Compression enables the underlying stream compression.
Definition nats.h:1891
const char * Bucket
Bucket is the name of the object store.
Definition nats.h:1842
jsPlacement * Placement
Placement is used to declare where the object store should be placed.
Definition nats.h:1884
const char * Description
Description is an optional description for the object store.
Definition nats.h:1847
int64_t MaxBytes
MaxBytes is the maximum size of the object store.
Definition nats.h:1862
Definition nats.h:2083
objStoreMeta Meta
objStoreMeta contains high level information about the object.
Definition nats.h:2087
const char * Bucket
Bucket is the name of the object store.
Definition nats.h:2092
bool Deleted
Deleted indicates if the object is marked as deleted.
Definition nats.h:2126
uint64_t Size
Size is the size of the object in bytes. It only includes the size of the object itself,...
Definition nats.h:2102
uint32_t Chunks
Chunks is the number of chunks the object is split into.
Definition nats.h:2114
int64_t ModTime
ModTime is the last modification time of the object (in unix nanoseconds).
Definition nats.h:2107
const char * Digest
Digest is the SHA-256 digest of the object.
Definition nats.h:2121
const char * NUID
NUID is the unique identifier for the object set when putting the object into the store.
Definition nats.h:2097
Definition nats.h:2138
int Count
Definition nats.h:2140
objStoreInfo ** List
Definition nats.h:2139
Definition nats.h:2048
const char * Description
Description is an optional description for the object.
Definition nats.h:2060
const char * Name
Name is the name of the object.
Definition nats.h:2055
objStoreMetaOptions Opts
Additional options for the object.
Definition nats.h:2075
natsMetadata Metadata
Metadata is the user supplied metadata for the object.
Definition nats.h:2070
natsHeader * Headers
Headers is an optional set of user-defined headers for the object.
Definition nats.h:2065
Definition nats.h:2027
objStoreLink * Link
Link contains information about a link to another object or object store.
Definition nats.h:2033
uint32_t ChunkSize
ChunkSize is the maximum size of each chunk in bytes.
Definition nats.h:2040
Definition nats.h:1910
char ** List
Definition nats.h:1911
int Count
Definition nats.h:1912
Definition nats.h:2156
bool ShowDeleted
ShowDeleted includes deleted object in the result.
Definition nats.h:2163
Definition nats.h:1930
bool Sealed
Sealed indicates the stream is sealed and cannot be modified in any way.
Definition nats.h:1959
bool IsCompressed
IsCompressed indicates if the data is compressed on disk.
Definition nats.h:1986
const char * Description
Description is the description supplied when creating the bucket.
Definition nats.h:1939
jsStorageType Storage
Storage indicates the underlying JetStream storage technology used tostore data.
Definition nats.h:1949
uint64_t Size
Size is the combined size of all data in the bucket including metadata, in bytes.
Definition nats.h:1964
const char * Bucket
Bucket is the name of the object store.
Definition nats.h:1934
const char * BackingStore
BackingStore indicates what technology is used for storage of the bucket.
Definition nats.h:1971
jsStreamInfo * StreamInfo
StreamInfo is the stream info retrieved to create the status.
Definition nats.h:1981
int Replicas
Replicas indicates how many storage replicas are kept for the data in the bucket.
Definition nats.h:1954
int64_t TTL
TTL indicates how long (in milliseconds) objects are kept in the bucket.
Definition nats.h:1944
natsMetadata Metadata
Metadata is the user supplied metadata for the bucket.
Definition nats.h:1976
Definition nats.h:1998
int Count
Definition nats.h:2000
objStoreStatus ** List
Definition nats.h:1999
Definition nats.h:2173
bool UpdatesOnly
The watcher won't return information about existing objects.
Definition nats.h:2188
bool IgnoreDeletes
The watcher won't return information about deleted objects.
Definition nats.h:2180