NATS C Client with JetStream and Streaming support  3.8.0
The nats.io C Client, Supported by Synadia Communications Inc.
Loading...
Searching...
No Matches
jsStreamConfig Struct Reference

#include <nats.h>

Public Attributes

const char * Name
 
const char * Description
 
const char ** Subjects
 
int SubjectsLen
 
jsRetentionPolicy Retention
 
int64_t MaxConsumers
 
int64_t MaxMsgs
 
int64_t MaxBytes
 
int64_t MaxAge
 
int64_t MaxMsgsPerSubject
 
int32_t MaxMsgSize
 
jsDiscardPolicy Discard
 
jsStorageType Storage
 
int64_t Replicas
 
bool NoAck
 
const char * Template
 
int64_t Duplicates
 
jsPlacementPlacement
 
jsStreamSourceMirror
 
jsStreamSource ** Sources
 
int SourcesLen
 
bool Sealed
 Seal a stream so no messages can get our or in.
 
bool DenyDelete
 Restrict the ability to delete messages.
 
bool DenyPurge
 Restrict the ability to purge messages.
 
bool AllowRollup
 
jsRePublishRePublish
 
bool AllowDirect
 
bool MirrorDirect
 
bool DiscardNewPerSubject
 
natsMetadata Metadata
 Configuration options introduced in 2.10.
 
jsStorageCompression Compression
 
uint64_t FirstSeq
 
jsSubjectTransformConfig SubjectTransform
 
jsStreamConsumerLimits ConsumerLimits
 

Detailed Description

Configuration of a JetStream stream.

There are sensible defaults for most. If no subjects are given the name will be used as the only subject.

In order to add/update a stream, a configuration needs to be set. The typical usage would be to initialize all required objects on the stack and configure them, then pass the pointer to the configuration to js_AddStream or js_UpdateStream.

Note
The strings are applications owned and will not be freed by the library.
NATS server 2.10 added user-provided Metadata, storage Compression type, FirstSeq to specify the starting sequence number, and SubjectTransform.
See also
jsStreamConfig_Init
jsStreamConfig sc;
jsPlacement p;
jsStreamSource m;
jsExternalStream esm;
jsStreamSource s1;
jsStreamSource s2;
jsExternalStream esmS2;
const char *subjects[] = {"foo", "bar"};
const char *tags[] = {"tag1", "tag2"};
jsStreamSource *sources[] = {&s1, &s2};
jsRePublish rp;
jsStreamConfig_Init(&sc);
jsPlacement_Init(&p);
p.Cluster = "MyCluster";
p.Tags = tags;
p.TagsLen = 2;
jsStreamSource_Init(&m);
m.Name = "AStream";
m.OptStartSeq = 100;
m.FilterSubject = "foo";
jsExternalStream_Init(&esm);
esm.APIPrefix = "mirror.prefix.";
esm.DeliverPrefix = "deliver.prefix.";
m.External = &esm;
jsStreamSource_Init(&s1);
s1.Name = "StreamOne";
s1.OptStartSeq = 10;
s1.FilterSubject = "stream.one";
jsStreamSource_Init(&s2);
s2.Name = "StreamTwo";
s2.FilterSubject = "stream.two";
jsExternalStream_Init(&esmS2);
esmS2.APIPrefix = "mirror.prefix.";
esmS2.DeliverPrefix = "deliver.prefix.";
s2.External = &esmS2;
sc.Name = "MyStream";
sc.Subjects = subjects;
sc.SubjectsLen = 2;
sc.Retention = js_InterestPolicy;
sc.Replicas = 3;
sc.Placement = &p;
sc.Mirror = &m;
sc.Sources = sources;
sc.SourcesLen = 2;
// For RePublish subject:
jsRePublish_Init(&rp);
rp.Source = ">";
rp.Destination = "RP.>";
sc.RePublish = &rp;
s = js_AddStream(&si, js, &sc, NULL, &jerr);

Member Data Documentation

◆ Name

const char* jsStreamConfig::Name

◆ Description

const char* jsStreamConfig::Description

◆ Subjects

const char** jsStreamConfig::Subjects

◆ SubjectsLen

int jsStreamConfig::SubjectsLen

◆ Retention

jsRetentionPolicy jsStreamConfig::Retention

◆ MaxConsumers

int64_t jsStreamConfig::MaxConsumers

◆ MaxMsgs

int64_t jsStreamConfig::MaxMsgs

◆ MaxBytes

int64_t jsStreamConfig::MaxBytes

◆ MaxAge

int64_t jsStreamConfig::MaxAge

◆ MaxMsgsPerSubject

int64_t jsStreamConfig::MaxMsgsPerSubject

◆ MaxMsgSize

int32_t jsStreamConfig::MaxMsgSize

◆ Discard

jsDiscardPolicy jsStreamConfig::Discard

◆ Storage

jsStorageType jsStreamConfig::Storage

◆ Replicas

int64_t jsStreamConfig::Replicas

◆ NoAck

bool jsStreamConfig::NoAck

◆ Template

const char* jsStreamConfig::Template

◆ Duplicates

int64_t jsStreamConfig::Duplicates

◆ Placement

jsPlacement* jsStreamConfig::Placement

◆ Mirror

jsStreamSource* jsStreamConfig::Mirror

◆ Sources

jsStreamSource** jsStreamConfig::Sources

◆ SourcesLen

int jsStreamConfig::SourcesLen

◆ Sealed

bool jsStreamConfig::Sealed

◆ DenyDelete

bool jsStreamConfig::DenyDelete

◆ DenyPurge

bool jsStreamConfig::DenyPurge

◆ AllowRollup

bool jsStreamConfig::AllowRollup

Allows messages to be placed into the system and purge all older messages using a special message header.

◆ RePublish

jsRePublish* jsStreamConfig::RePublish

◆ AllowDirect

bool jsStreamConfig::AllowDirect

◆ MirrorDirect

bool jsStreamConfig::MirrorDirect

◆ DiscardNewPerSubject

bool jsStreamConfig::DiscardNewPerSubject

◆ Metadata

natsMetadata jsStreamConfig::Metadata
  • Metadata is a user-provided array of key/value pairs, encoded as a string array [n1, v1, n2, v2, ...] representing key/value pairs {n1:v1, n2:v2, ...}.
  • Compression: js_StorageCompressionNone (default) or js_StorageCompressionS2
  • FirstSeq: the starting sequence number for the stream.
  • SubjectTransformConfig is for applying a subject transform (to matching messages) before doing anything else when a new message is received
  • ConsumerLimits is for setting the limits on certain options on all consumers of the stream.

◆ Compression

jsStorageCompression jsStreamConfig::Compression

◆ FirstSeq

uint64_t jsStreamConfig::FirstSeq

◆ SubjectTransform

jsSubjectTransformConfig jsStreamConfig::SubjectTransform

◆ ConsumerLimits

jsStreamConsumerLimits jsStreamConfig::ConsumerLimits

The documentation for this struct was generated from the following file: