Class StreamConfigBuilder
-
- All Implemented Interfaces:
public final class StreamConfigBuilderBuilder for JetStream stream configuration
-
-
Field Summary
Fields Modifier and Type Field Description private List<String>subjectsprivate RetentionPolicyretentionPolicyprivate IntegermaxConsumersprivate LongmaxMessagesprivate LongmaxBytesprivate DurationmaxAgeprivate IntegermaxMsgSizeprivate StorageTypestorageTypeprivate Integerreplicasprivate BooleannoAckprivate DurationduplicateWindowprivate DiscardPolicydiscardPolicyprivate Stringdescriptionprivate LongmaxMessagesPerSubjectprivate BooleanallowDirectprivate BooleandenyDeleteprivate BooleandenyPurgeprivate CompressionOptioncompressionOption
-
Constructor Summary
Constructors Constructor Description StreamConfigBuilder()
-
Method Summary
Modifier and Type Method Description final List<String>getSubjects()List of subjects this stream listens toSupports wildcards (e.g., "orders.*", "payments.>"). final UnitsetSubjects(List<String> <set-?>)List of subjects this stream listens toSupports wildcards (e.g., "orders.*", "payments.>"). final RetentionPolicygetRetentionPolicy()Retention policy for the stream final UnitsetRetentionPolicy(RetentionPolicy <set-?>)Retention policy for the stream final IntegergetMaxConsumers()Maximum number of consumers allowed on this stream (-1 for unlimited) final UnitsetMaxConsumers(Integer <set-?>)Maximum number of consumers allowed on this stream (-1 for unlimited) final LonggetMaxMessages()Maximum number of messages to retain (-1 for unlimited) final UnitsetMaxMessages(Long <set-?>)Maximum number of messages to retain (-1 for unlimited) final LonggetMaxBytes()Maximum total bytes to retain (-1 for unlimited) final UnitsetMaxBytes(Long <set-?>)Maximum total bytes to retain (-1 for unlimited) final DurationgetMaxAge()Maximum age of messages to retain (Duration. final UnitsetMaxAge(Duration <set-?>)Maximum age of messages to retain (Duration. final IntegergetMaxMsgSize()Maximum size of a single message (-1 for unlimited) final UnitsetMaxMsgSize(Integer <set-?>)Maximum size of a single message (-1 for unlimited) final StorageTypegetStorageType()Storage type for the stream final UnitsetStorageType(StorageType <set-?>)Storage type for the stream final IntegergetReplicas()Number of replicas for the stream (1-5) final UnitsetReplicas(Integer <set-?>)Number of replicas for the stream (1-5) final BooleangetNoAck()Disable acknowledgments (used for fire-and-forget scenarios) final UnitsetNoAck(Boolean <set-?>)Disable acknowledgments (used for fire-and-forget scenarios) final DurationgetDuplicateWindow()Window within which to track duplicate messages final UnitsetDuplicateWindow(Duration <set-?>)Window within which to track duplicate messages final DiscardPolicygetDiscardPolicy()Discard policy when limits are reached final UnitsetDiscardPolicy(DiscardPolicy <set-?>)Discard policy when limits are reached final StringgetDescription()Description of the stream final UnitsetDescription(String <set-?>)Description of the stream final LonggetMaxMessagesPerSubject()Maximum messages per subject (-1 for unlimited) final UnitsetMaxMessagesPerSubject(Long <set-?>)Maximum messages per subject (-1 for unlimited) final BooleangetAllowDirect()Serve reads straight from the stream, without a consumerWhat makes getMessage-shaped lookups and a mirror's local reads a single round trip rather than a consumer created and torn down per call.final UnitsetAllowDirect(Boolean <set-?>)Serve reads straight from the stream, without a consumerWhat makes getMessage-shaped lookups and a mirror's local reads a single round trip rather than a consumer created and torn down per call.final BooleangetDenyDelete()Refuse per-message deletes on this stream final UnitsetDenyDelete(Boolean <set-?>)Refuse per-message deletes on this stream final BooleangetDenyPurge()Refuse purges on this stream final UnitsetDenyPurge(Boolean <set-?>)Refuse purges on this stream final CompressionOptiongetCompressionOption()Whether stored messages are compressedFile storage only; a memory stream ignores it. final UnitsetCompressionOption(CompressionOption <set-?>)Whether stored messages are compressedFile storage only; a memory stream ignores it. final Unitraw(Function1<StreamConfiguration.Builder, Unit> customize)Reach a jnats stream setting this DSL does not model StreamConfiguration.Buildercarries more than natsy has an opinion about;subjectTransform,consumerLimits,allowRollup,mirrorDirect,firstSequenceandmetadataare all reachable here rather than being unreachable until natsy grows a property for each.final Unitplacement(Function1<PlacementBuilder, Unit> block)Configure placement for the stream final Unitmirror(Function1<StreamSourceBuilder, Unit> block)Configure mirror to replicate another stream final Unitsource(Function1<StreamSourceBuilder, Unit> block)Add a source stream for aggregationA stream fed only by sources needs no subjects of its own, the same as a mirror. final Unitrepublish(Function1<RepublishBuilder, Unit> block)Configure republishing republish { source = "orders.*" destination = "mirror.$1" }-
-
Method Detail
-
getSubjects
final List<String> getSubjects()
List of subjects this stream listens to
Supports wildcards (e.g., "orders.*", "payments.>"). May be empty when the stream is a mirror or aggregates from source streams - a stream fed only by other streams has no subjects of its own.
-
setSubjects
final Unit setSubjects(List<String> <set-?>)
List of subjects this stream listens to
Supports wildcards (e.g., "orders.*", "payments.>"). May be empty when the stream is a mirror or aggregates from source streams - a stream fed only by other streams has no subjects of its own.
-
getRetentionPolicy
final RetentionPolicy getRetentionPolicy()
Retention policy for the stream
-
setRetentionPolicy
final Unit setRetentionPolicy(RetentionPolicy <set-?>)
Retention policy for the stream
-
getMaxConsumers
final Integer getMaxConsumers()
Maximum number of consumers allowed on this stream (-1 for unlimited)
-
setMaxConsumers
final Unit setMaxConsumers(Integer <set-?>)
Maximum number of consumers allowed on this stream (-1 for unlimited)
-
getMaxMessages
final Long getMaxMessages()
Maximum number of messages to retain (-1 for unlimited)
-
setMaxMessages
final Unit setMaxMessages(Long <set-?>)
Maximum number of messages to retain (-1 for unlimited)
-
getMaxBytes
final Long getMaxBytes()
Maximum total bytes to retain (-1 for unlimited)
-
setMaxBytes
final Unit setMaxBytes(Long <set-?>)
Maximum total bytes to retain (-1 for unlimited)
-
getMaxAge
final Duration getMaxAge()
Maximum age of messages to retain (Duration.ZERO for unlimited)
-
setMaxAge
final Unit setMaxAge(Duration <set-?>)
Maximum age of messages to retain (Duration.ZERO for unlimited)
-
getMaxMsgSize
final Integer getMaxMsgSize()
Maximum size of a single message (-1 for unlimited)
-
setMaxMsgSize
final Unit setMaxMsgSize(Integer <set-?>)
Maximum size of a single message (-1 for unlimited)
-
getStorageType
final StorageType getStorageType()
Storage type for the stream
-
setStorageType
final Unit setStorageType(StorageType <set-?>)
Storage type for the stream
-
getReplicas
final Integer getReplicas()
Number of replicas for the stream (1-5)
-
setReplicas
final Unit setReplicas(Integer <set-?>)
Number of replicas for the stream (1-5)
-
setNoAck
final Unit setNoAck(Boolean <set-?>)
Disable acknowledgments (used for fire-and-forget scenarios)
-
getDuplicateWindow
final Duration getDuplicateWindow()
Window within which to track duplicate messages
-
setDuplicateWindow
final Unit setDuplicateWindow(Duration <set-?>)
Window within which to track duplicate messages
-
getDiscardPolicy
final DiscardPolicy getDiscardPolicy()
Discard policy when limits are reached
-
setDiscardPolicy
final Unit setDiscardPolicy(DiscardPolicy <set-?>)
Discard policy when limits are reached
-
getDescription
final String getDescription()
Description of the stream
-
setDescription
final Unit setDescription(String <set-?>)
Description of the stream
-
getMaxMessagesPerSubject
final Long getMaxMessagesPerSubject()
Maximum messages per subject (-1 for unlimited)
-
setMaxMessagesPerSubject
final Unit setMaxMessagesPerSubject(Long <set-?>)
Maximum messages per subject (-1 for unlimited)
-
getAllowDirect
final Boolean getAllowDirect()
Serve reads straight from the stream, without a consumer
What makes
getMessage-shaped lookups and a mirror's local reads a single round trip rather than a consumer created and torn down per call.
-
setAllowDirect
final Unit setAllowDirect(Boolean <set-?>)
Serve reads straight from the stream, without a consumer
What makes
getMessage-shaped lookups and a mirror's local reads a single round trip rather than a consumer created and torn down per call.
-
getDenyDelete
final Boolean getDenyDelete()
Refuse per-message deletes on this stream
-
setDenyDelete
final Unit setDenyDelete(Boolean <set-?>)
Refuse per-message deletes on this stream
-
getDenyPurge
final Boolean getDenyPurge()
Refuse purges on this stream
-
setDenyPurge
final Unit setDenyPurge(Boolean <set-?>)
Refuse purges on this stream
-
getCompressionOption
final CompressionOption getCompressionOption()
Whether stored messages are compressed
File storage only; a memory stream ignores it.
-
setCompressionOption
final Unit setCompressionOption(CompressionOption <set-?>)
Whether stored messages are compressed
File storage only; a memory stream ignores it.
-
raw
final Unit raw(Function1<StreamConfiguration.Builder, Unit> customize)
Reach a jnats stream setting this DSL does not model
StreamConfiguration.Buildercarries more than natsy has an opinion about;subjectTransform,consumerLimits,allowRollup,mirrorDirect,firstSequenceandmetadataare all reachable here rather than being unreachable until natsy grows a property for each.Applied last, after everything else this block sets, so it can also override those. Blocks accumulate, and they apply on the update path too - a
raw { }in astream { }block that finds the stream already there is part of the patch, exactly like an assigned property.raw { subjectTransform(SubjectTransform.builder().source("orders.>").destination("all.>").build()) }
-
placement
final Unit placement(Function1<PlacementBuilder, Unit> block)
Configure placement for the stream
-
mirror
final Unit mirror(Function1<StreamSourceBuilder, Unit> block)
Configure mirror to replicate another stream
-
source
final Unit source(Function1<StreamSourceBuilder, Unit> block)
Add a source stream for aggregation
A stream fed only by sources needs no subjects of its own, the same as a mirror.
-
republish
final Unit republish(Function1<RepublishBuilder, Unit> block)
Configure republishing
republish { source = "orders.*" destination = "mirror.$1" }
-
-
-
-