pub struct Publisher<B: Bus> { /* private fields */ }Expand description
A publisher associated with a Channel and a Bus. Publishers allow for publishing messages with payloads of the Bus::PublishPayload type. Publishers take care of serializing the payloads before publishing.
Implementations§
Source§impl<'p, B> Publisher<B>
impl<'p, B> Publisher<B>
Sourcepub async fn publish(
&self,
args: B::Args,
payload: &B::PublishPayload,
) -> Result<()>
pub async fn publish( &self, args: B::Args, payload: &B::PublishPayload, ) -> Result<()>
Publish a message onto a direct queue with the name produced by DirectBus::queue given the passed DirectBus::Args
Source§impl<'i, 'b, 'f, B> Publisher<B>where
B: RpcCommBus,
B::InitialPayload: Deserialize<'i> + Serialize,
B::BackPayload: Deserialize<'b> + Serialize,
B::ForthPayload: Deserialize<'f> + Serialize,
impl<'i, 'b, 'f, B> Publisher<B>where
B: RpcCommBus,
B::InitialPayload: Deserialize<'i> + Serialize,
B::BackPayload: Deserialize<'b> + Serialize,
B::ForthPayload: Deserialize<'f> + Serialize,
Sourcepub async fn publish_recv_comm(
&self,
args: B::Args,
payload: &B::InitialPayload,
) -> Result<impl Stream<Item = Delivery<BackReply<B>>>>
pub async fn publish_recv_comm( &self, args: B::Args, payload: &B::InitialPayload, ) -> Result<impl Stream<Item = Delivery<BackReply<B>>>>
Publish an initial message onto the RpcCommBus, and receive the replies with with RpcCommBus::BackPayload payloads onto the returned Stream. The replies can be obtained by calling futures::StreamExt::next on the returned Stream.
Source§impl<'r, 'p, B> Publisher<B>where
B: RpcBus<Chan = RpcChannel>,
B::PublishPayload: Deserialize<'p> + Serialize,
B::ReplyPayload: Deserialize<'r> + Serialize,
impl<'r, 'p, B> Publisher<B>where
B: RpcBus<Chan = RpcChannel>,
B::PublishPayload: Deserialize<'p> + Serialize,
B::ReplyPayload: Deserialize<'r> + Serialize,
Sourcepub async fn publish_recv_many(
&self,
args: B::Args,
payload: &B::PublishPayload,
) -> Result<impl Stream<Item = Delivery<Reply<B>>>>
pub async fn publish_recv_many( &self, args: B::Args, payload: &B::PublishPayload, ) -> Result<impl Stream<Item = Delivery<Reply<B>>>>
Publish a message and await many replies. The replies can be obtained by calling StreamExt::next on the returned Stream.
Sourcepub async fn publish_recv_one(
&'r self,
args: B::Args,
payload: &B::PublishPayload,
) -> Result<impl Future<Output = Option<Delivery<Reply<B>>>>>
pub async fn publish_recv_one( &'r self, args: B::Args, payload: &B::PublishPayload, ) -> Result<impl Future<Output = Option<Delivery<Reply<B>>>>>
Publish a message and await a single reply. The reply can be obtained by awaiting the retured Future.
Source§impl<'p, B> Publisher<B>
impl<'p, B> Publisher<B>
Sourcepub async fn publish_topic(
&self,
routing_key: PublisherRoutingKey<B>,
payload: &B::PublishPayload,
) -> Result<()>
pub async fn publish_topic( &self, routing_key: PublisherRoutingKey<B>, payload: &B::PublishPayload, ) -> Result<()>
Publish a message onto a topic on the exchange associated with the TopicBus for this Publisher with the passed PublisherRoutingKey.