pub struct LapinPublisher { /* private fields */ }Expand description
Fire-and-forget publisher on the broker’s shared publish channel.
OutgoingMessage::name is the routing key; the target exchange is a property of the
publisher (the default exchange unless exchange says otherwise). On the
default exchange the routing key addresses the queue with that name.
Messages are published persistent (delivery mode 2) unless
persistent(false) opts out.
Obtained from LapinBroker::publisher; usable before
Broker::connect resolves the connection (publishing earlier returns
AmqpError::NotConnected).
Implementations§
Source§impl LapinPublisher
impl LapinPublisher
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.
Sourcepub fn confirms(self) -> ConfirmsPublisher
pub fn confirms(self) -> ConfirmsPublisher
Upgrades to a publisher that awaits broker confirms, with buffering transactions.
The recommended transactional publisher: durable and much faster than AMQP server transactions.
Sourcepub fn server_tx(self) -> ServerTxPublisher
pub fn server_tx(self) -> ServerTxPublisher
Upgrades to a publisher backed by AMQP server transactions (tx.select).
Server-side atomicity, at the cost of a synchronous commit round trip that is
significantly slower than confirms.
Trait Implementations§
Source§impl Clone for LapinPublisher
impl Clone for LapinPublisher
Source§fn clone(&self) -> LapinPublisher
fn clone(&self) -> LapinPublisher
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 LapinPublisher
impl Debug for LapinPublisher
Source§impl Publisher for LapinPublisher
impl Publisher for LapinPublisher
Source§async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
Publishes msg without waiting for a broker confirm.
§Errors
Returns AmqpError::NotConnected before Broker::connect resolves the connection and
AmqpError::Publish when the channel rejects the frame.
§Cancel safety
Not cancel safe: dropping the future may leave the message published or not.