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 }.getOrThrow() // 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) // Check status val isPaused = consumerCtx.isPaused()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 operationsThis class integrates with natsy's codec system to provide automatic serialization/deserialization of values and uses Kotlin's Result type for error handling. ObjectStore Wrapper around NATS ObjectStore that provides coroutine-friendly operationsThis class provides access to JetStream's Object Store functionality with proper coroutine support and streaming for large objects. 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 }.getOrThrow()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
val streamCtx = js.stream("MY_STREAM") { subjects = listOf("orders.*") maxMessages = 1000 }.getOrThrow() // Update the stream streamCtx.update { maxMessages = 2000 } // Purge every message streamCtx.purge() // Purge a single subject, or a subtree with "orders.>" streamCtx.purge("orders.cancelled") // List consumers streamCtx.consumers().collect { consumer -> println(consumer.name) }JetStreamExtensionsKt -
Enum Summary Enum Description RetentionPolicy Stream retention policy StorageType Stream storage type ReplayPolicy Consumer replay policy -
Object Summary Object Description Companion