pub struct ConfirmsPublish(/* private fields */);Expand description
The confirm-transactional publish policy: same options as LapinPublish, pairing into
ConfirmsPublisher.
Reached with LapinPublish::confirms.
§Examples
use ruststream_lapin::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Order {
id: u64,
}
#[derive(Serialize, Outgoing)]
#[outgoing(name = "shipment.requested")]
struct Shipment {
order_id: u64,
}
// The order is acknowledged only once the broker confirmed the shipment.
#[subscriber("orders")]
async fn ship(order: &Order, Out(shipments): Out<impl TransactionalPublisher>) -> HandlerOutcome {
let shipment = Shipment { order_id: order.id };
if shipments.message(&shipment).publish().await.is_err() {
return HandlerOutcome::retry();
}
HandlerOutcome::ack()
}
fn app() -> RustStream {
let broker = LapinBroker::new("amqp://localhost:5672");
let shipments = LapinPublish::default().exchange("shipments").confirms();
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(broker, |b| {
b.include(ship).out(DefaultSlot, shipments).build();
})
}Implementations§
Source§impl ConfirmsPublish
impl ConfirmsPublish
Sourcepub fn exchange(self, exchange: impl Into<String>) -> Self
pub fn exchange(self, exchange: impl Into<String>) -> Self
Publishes to exchange instead of the default exchange.
Sourcepub fn persistent(self, persistent: bool) -> Self
pub fn persistent(self, persistent: bool) -> Self
Whether messages are marked persistent (delivery mode 2). Defaults to true.
One message departs from this with the publish builder’s
persistent step.
Sourcepub fn priority(self, priority: u8) -> Self
pub fn priority(self, priority: u8) -> Self
The AMQP priority property messages carry. Unset by default, so the broker sees
no priority at all.
It only orders deliveries on a queue declared with x-max-priority. One message
departs from this with the publish builder’s
priority step.
Sourcepub fn expiration(self, ttl: Duration) -> Self
pub fn expiration(self, ttl: Duration) -> Self
The AMQP per-message expiration (TTL) messages carry: the broker drops one once
ttl has passed without it being consumed. Unset by default, so messages do not
expire.
One message departs from this with the publish builder’s
expiration step.
Trait Implementations§
Source§impl Clone for ConfirmsPublish
impl Clone for ConfirmsPublish
Source§impl Debug for ConfirmsPublish
impl Debug for ConfirmsPublish
Source§impl Default for ConfirmsPublish
impl Default for ConfirmsPublish
impl Eq for ConfirmsPublish
Source§impl LapinPublishPolicy for ConfirmsPublish
impl LapinPublishPolicy for ConfirmsPublish
Source§fn bind(self, connected: &ConnectedLapinBroker) -> Self::Live
fn bind(self, connected: &ConnectedLapinBroker) -> Self::Live
Source§impl PartialEq for ConfirmsPublish
impl PartialEq for ConfirmsPublish
Source§impl PublishPolicy<ConnectedLapinBroker> for ConfirmsPublish
impl PublishPolicy<ConnectedLapinBroker> for ConfirmsPublish
Source§type Live = ConfirmsPublisher
type Live = ConfirmsPublisher
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).Source§fn pair(
self,
connected: &ConnectedLapinBroker,
) -> impl Future<Output = Result<Self::Live, PairError>>
fn pair( self, connected: &ConnectedLapinBroker, ) -> impl Future<Output = Result<Self::Live, PairError>>
Source§fn channel_bindings(&self, destination: &str) -> Bindings
fn channel_bindings(&self, destination: &str) -> Bindings
AsyncAPI
document. Read moreSource§fn operation_bindings(&self, _destination: &str) -> Bindings
fn operation_bindings(&self, _destination: &str) -> Bindings
send operation in the document. Read moreimpl StructuralPartialEq for ConfirmsPublish
Auto Trait Implementations§
impl Freeze for ConfirmsPublish
impl RefUnwindSafe for ConfirmsPublish
impl Send for ConfirmsPublish
impl Sync for ConfirmsPublish
impl Unpin for ConfirmsPublish
impl UnsafeUnpin for ConfirmsPublish
impl UnwindSafe for ConfirmsPublish
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more