Package eu.vstoyanov.natsy.jetstream
See: Description
-
Class Summary Class Description ConsumerConfigBuilder Builder for JetStream consumer configuration ConsumerConfig DSL for configuring JetStream consumersExample usage: val consumerCtx = js.consumer("MY_STREAM", "MY_CONSUMER") { durable = "MY_CONSUMER" deliverPolicy = DeliverPolicy.ALL ackPolicy = AckPolicy.EXPLICIT ackWait = 30.seconds maxDeliver = 5 filterSubject = "orders.>" }ConsumerContext Context for JetStream consumer operationsProvides access to consumer management and monitoring including: Consumer information and updates
Pause/resume operations
Monitoring metrics
val consumerCtx = js.consumer("MY_STREAM", "MY_CONSUMER") { durable = "MY_CONSUMER" ackPolicy = AckPolicy.EXPLICIT maxDeliver = 5 } // Update the consumer consumerCtx.update { maxDeliver = 10 } // Pause the consumer until it is explicitly resumed consumerCtx.pause() // ...or until a deadline, after which the server resumes it automatically consumerCtx.pause(30.minutes) // Everything worth monitoring, in one round trip val stats = consumerCtx.stats() println("${stats.ackPending} unacknowledged, ${stats.pending} still to come")JetStreamBatch Wrapper for a batch of JetStream messages from a pull consumerProvides batch-level operations for efficient message processing including batch acknowledgment and selective acknowledgment up to a specific message. JetStreamConfigBuilder Builder for JetStream configuration JetStreamConfig Configuration for JetStream operations JetStreamContext Context for JetStream operationsProvides type-safe, coroutine-friendly access to JetStream functionality including publishing, stream management, and consumer operations. JetStreamMessage Wrapper for JetStream messages with acknowledgment controlsProvides type-safe access to message payload and metadata, along with coroutine-friendly acknowledgment operations. KeyValueConfigBuilder Builder for Key-Value store configuration KeyValueConfig DSL builder for Key-Value store configurationProvides a Kotlin-friendly way to configure Key-Value buckets with sensible defaults and compile-time validation. KeyValueStore Wrapper around NATS KeyValue that provides type-safe, coroutine-friendly operationsValues are serialized through natsy's codec registry. ObjectStore Wrapper around NATS ObjectStore that provides coroutine-friendly operationsLarge objects stream: putFile reads from disk a chunk at a time, getFile writes to disk the same way, and get writes into any OutputStream the caller hands it. PlacementConfigBuilder Builder for placement configuration for object store clustering PlacementConfig Placement configuration for object store clustering ObjectStoreConfigBuilder Builder for Object Store configuration ObjectStoreConfig Configuration for a JetStream Object Store bucketExample: val objectStore = js.objectStore("file-storage") { description = "Application file storage" storageType = StorageType.FILE replicas = 3 maxBucketSize = 10 * 1024 * 1024 * 1024L // 10GB }PublishExpectations Expectations for JetStream publishing to ensure message ordering and deduplication StreamConfigBuilder Builder for JetStream stream configuration StreamConfig DSL for configuring JetStream streamsExample usage: val streamCtx = js.stream("MY_STREAM") { subjects = listOf("orders.*", "payments.*") retentionPolicy = RetentionPolicy.LIMITS maxMessages = 1000000 maxBytes = 1024 * 1024 * 1024 // 1GB storageType = StorageType.FILE replicas = 3 }StreamContext Context for JetStream stream operationsProvides access to stream management and operations including: Stream information and updates
Message purging and deletion
Consumer listing
-
Enum Summary Enum Description RetentionPolicy Stream retention policy StorageType Where a stream or bucket keeps its messagesThe same choice for streams, Key-Value buckets and Object Store buckets - each of the three is a stream underneath. CompressionOption Whether a stream's file storage is compressed ReplayPolicy Consumer replay policy -
Object Summary Object Description Companion