pub struct ConnectedLapinBroker { /* private fields */ }Expand description
The typed witness that Broker::connect succeeded: holds the live connection.
Everything connection-bound hangs off this value: subscriptions (Subscribe,
subscribe), publishers (publisher), and requesters
(requester). ConnectedBroker::shutdown consumes it, so a publish or
subscribe after shutdown is a compile error for the owner of the handle.
Implementations§
Source§impl ConnectedLapinBroker
impl ConnectedLapinBroker
Sourcepub fn server_spec(&self) -> ServerSpec
pub fn server_spec(&self) -> ServerSpec
The AsyncAPI server description of the connection this broker dialled.
Sourcepub async fn subscribe(
&self,
def: RabbitQueue,
) -> Result<LapinSubscriber, AmqpError>
pub async fn subscribe( &self, def: RabbitQueue, ) -> Result<LapinSubscriber, AmqpError>
Opens a subscription for def, declaring its topology first when the broker opted in.
§Errors
Returns AmqpError::Closed after shutdown, AmqpError::Declare when opted-in
declaration fails, AmqpError::InvalidOptions for contradictory descriptor options,
and AmqpError::Subscribe when the channel or consumer cannot be opened (for example
the queue does not exist and declaration was not opted into).
Sourcepub fn publisher<P: LapinPublishPolicy>(&self, policy: P) -> P::Live
pub fn publisher<P: LapinPublishPolicy>(&self, policy: P) -> P::Live
A live publisher for policy.
LapinPublish pairs into the fire-and-forget publisher,
ConfirmsPublish into the confirm-transactional one, and
ServerTxPublish into the AMQP-server-transactional one. All
three are cheap to build and cheap to clone.
§Examples
use ruststream::Broker;
use ruststream_lapin::{LapinBroker, LapinPublish};
let connected = LapinBroker::new("amqp://localhost:5672").connect().await?;
let orders = connected.publisher(LapinPublish::default().exchange("orders"));
let shipments = connected.publisher(LapinPublish::default().confirms());Sourcepub fn requester(&self, policy: LapinRequest) -> LapinRequester
pub fn requester(&self, policy: LapinRequest) -> LapinRequester
A live request/reply client over RabbitMQ direct reply-to.
The requester half of LapinRequest; publisher accepts the same
policy, this accessor only names the result.
Trait Implementations§
Source§impl ConnectedBroker for ConnectedLapinBroker
impl ConnectedBroker for ConnectedLapinBroker
Source§impl Debug for ConnectedLapinBroker
impl Debug for ConnectedLapinBroker
Source§impl DefaultPublish for ConnectedLapinBroker
impl DefaultPublish for ConnectedLapinBroker
Source§type Policy = LapinPublish
type Policy = LapinPublish
Source§impl PublishPolicy<ConnectedLapinBroker> for LapinPublish
impl PublishPolicy<ConnectedLapinBroker> for LapinPublish
Source§type Live = LapinPublisher
type Live = LapinPublisher
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§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§impl PublishPolicy<ConnectedLapinBroker> for ServerTxPublish
impl PublishPolicy<ConnectedLapinBroker> for ServerTxPublish
Source§type Live = ServerTxPublisher
type Live = ServerTxPublisher
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§impl PublishPolicy<ConnectedLapinBroker> for LapinRequest
impl PublishPolicy<ConnectedLapinBroker> for LapinRequest
Source§type Live = LapinRequester
type Live = LapinRequester
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§impl Subscribe for ConnectedLapinBroker
impl Subscribe for ConnectedLapinBroker
Source§async fn subscribe(&self, name: &str) -> Result<Self::Subscriber, Self::Error>
async fn subscribe(&self, name: &str) -> Result<Self::Subscriber, Self::Error>
Subscribes to the queue name with descriptor defaults (durable, shared).