diff --git a/async-nats/src/jetstream/context.rs b/async-nats/src/jetstream/context.rs index dd90e5985..65d1ae2e5 100644 --- a/async-nats/src/jetstream/context.rs +++ b/async-nats/src/jetstream/context.rs @@ -644,6 +644,8 @@ impl Context { num_replicas, discard: stream::DiscardPolicy::New, mirror_direct: config.mirror_direct, + #[cfg(feature = "server_2_10")] + compression: config.compression, ..Default::default() }) .await diff --git a/async-nats/src/jetstream/kv/mod.rs b/async-nats/src/jetstream/kv/mod.rs index f30db892d..021cec742 100644 --- a/async-nats/src/jetstream/kv/mod.rs +++ b/async-nats/src/jetstream/kv/mod.rs @@ -38,8 +38,8 @@ use super::{ consumer::{push::OrderedError, DeliverPolicy, StreamError, StreamErrorKind}, context::{PublishError, PublishErrorKind}, stream::{ - ConsumerError, ConsumerErrorKind, DirectGetError, DirectGetErrorKind, RawMessage, - Republish, Source, StorageType, Stream, + Compression, ConsumerError, ConsumerErrorKind, DirectGetError, DirectGetErrorKind, + RawMessage, Republish, Source, StorageType, Stream, }, }; @@ -120,6 +120,9 @@ pub struct Config { pub sources: Option>, /// Allow mirrors using direct API. pub mirror_direct: bool, + /// Compression + #[cfg(feature = "server_2_10")] + pub compression: Option, } /// Describes what kind of operation and entry represents diff --git a/async-nats/src/jetstream/stream.rs b/async-nats/src/jetstream/stream.rs index 6509c2a06..f4df1d4ed 100644 --- a/async-nats/src/jetstream/stream.rs +++ b/async-nats/src/jetstream/stream.rs @@ -1063,7 +1063,6 @@ pub struct Config { /// to [Compression::None], which is different from not overriding global config with anything. #[serde(default, skip_serializing_if = "Option::is_none")] pub compression: Option, - #[cfg(feature = "server_2_10")] /// Set limits on consumers that are created on this stream. #[serde(default, deserialize_with = "default_consumer_limits_as_none")]