pub struct JetStreamPublish { /* private fields */ }Expand description
The JetStream publish policy: pure declaration, constructible anywhere.
Beyond naming the transport, the policy carries the stream expectations the server checks
before accepting a message. They are per-publisher declarations: a publisher that states
expect_stream("ORDERS") fails loudly if its subject is routed to another stream, instead of
writing somewhere unintended. The sequence and message-id expectations serve a single writer
enforcing an optimistic-concurrency chain.
§Examples
use ruststream_nats::JetStreamPublish;
let policy = JetStreamPublish::default().expect_stream("ORDERS");Implementations§
Source§impl JetStreamPublish
impl JetStreamPublish
Sourcepub fn expect_stream(self, stream: impl Into<String>) -> Self
pub fn expect_stream(self, stream: impl Into<String>) -> Self
Requires the subject to be served by the named stream. The server rejects the publish otherwise, so a misrouted subject surfaces as an error rather than a silent write.
Sourcepub const fn expect_last_sequence(self, sequence: u64) -> Self
pub const fn expect_last_sequence(self, sequence: u64) -> Self
Requires the stream’s last sequence to be sequence at the moment of the publish.
Sourcepub const fn expect_last_subject_sequence(self, sequence: u64) -> Self
pub const fn expect_last_subject_sequence(self, sequence: u64) -> Self
Requires the last sequence on the published subject to be sequence.
Sourcepub fn expect_last_message_id(self, id: impl Into<String>) -> Self
pub fn expect_last_message_id(self, id: impl Into<String>) -> Self
Requires the stream’s last message id (the Nats-Msg-Id of the previous publish) to be
id.
Trait Implementations§
Source§impl Clone for JetStreamPublish
impl Clone for JetStreamPublish
Source§fn clone(&self) -> JetStreamPublish
fn clone(&self) -> JetStreamPublish
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JetStreamPublish
impl Debug for JetStreamPublish
Source§impl Default for JetStreamPublish
impl Default for JetStreamPublish
Source§fn default() -> JetStreamPublish
fn default() -> JetStreamPublish
impl Eq for JetStreamPublish
Source§impl NatsPublishPolicy for JetStreamPublish
impl NatsPublishPolicy for JetStreamPublish
Source§fn bind(self, connected: &ConnectedNatsBroker) -> Self::Live
fn bind(self, connected: &ConnectedNatsBroker) -> Self::Live
Source§impl PartialEq for JetStreamPublish
impl PartialEq for JetStreamPublish
Source§impl PublishPolicy<ConnectedNatsBroker> for JetStreamPublish
impl PublishPolicy<ConnectedNatsBroker> for JetStreamPublish
Source§type Live = JetStreamPublisher
type Live = JetStreamPublisher
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).