pub struct PulsarPublish;Expand description
The publish policy for PulsarPublisher: pure declaration, constructible anywhere,
paired with the connected broker by the runtime after connect.
In the generated AsyncAPI document it describes the channel it publishes to: the
specification’s pulsar channel binding is a namespace and a persistence, and both live in
the destination’s topic name, which the runtime hands the policy. Its operation and message
objects are empty, and a partition key belongs to one message rather than to the policy.
Replies go to the destination the reply type or the mount site declares, the channel the
document reports for them.
§Examples
A routes file that does not import this crate’s prelude names the policy by this name:
use ruststream::prelude::*;
use ruststream_pulsar::{PulsarBroker, PulsarPublish, PulsarSubscription};
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Order {
id: u64,
}
#[derive(Outgoing, Serialize)]
#[outgoing(name = "receipts")]
struct Receipt {
id: u64,
}
#[subscriber(PulsarSubscription::new("orders", "workers"), reply)]
async fn confirm(order: &Order) -> Receipt {
Receipt { id: order.id }
}
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
PulsarBroker::new("pulsar://localhost:6650"),
|b| {
b.include(confirm).out_reply(PulsarPublish);
},
)
}Trait Implementations§
Source§impl Clone for PulsarPublish
impl Clone for PulsarPublish
impl Copy for PulsarPublish
Source§impl Debug for PulsarPublish
impl Debug for PulsarPublish
Source§impl Default for PulsarPublish
impl Default for PulsarPublish
Source§impl PublishPolicy<ConnectedPulsarBroker> for PulsarPublish
impl PublishPolicy<ConnectedPulsarBroker> for PulsarPublish
Source§type Live = PulsarPublisher
type Live = PulsarPublisher
The live form this policy pairs into: a
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: &ConnectedPulsarBroker,
) -> impl Future<Output = Result<Self::Live, PairError>>
fn pair( self, connected: &ConnectedPulsarBroker, ) -> impl Future<Output = Result<Self::Live, PairError>>
Pairs the policy with a connected broker, producing the live publisher. Read more
Source§fn channel_bindings(&self, channel: &str) -> Bindings
fn channel_bindings(&self, channel: &str) -> Bindings
What a publish through this policy adds to its channel in the generated
AsyncAPI
document. Read moreSource§fn operation_bindings(&self, channel: &str) -> Bindings
fn operation_bindings(&self, channel: &str) -> Bindings
What a publish through this policy adds to its
send operation in the document. Read moreAuto Trait Implementations§
impl Freeze for PulsarPublish
impl RefUnwindSafe for PulsarPublish
impl Send for PulsarPublish
impl Sync for PulsarPublish
impl Unpin for PulsarPublish
impl UnsafeUnpin for PulsarPublish
impl UnwindSafe for PulsarPublish
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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