ChannelCallback

Trait ChannelCallback 

Source
pub trait ChannelCallback {
    // Required methods
    fn close<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        close: CloseChannel,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn cancel<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        cancel: Cancel,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn flow<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        active: bool,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn publish_ack<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        ack: Ack,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn publish_nack<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        nack: Nack,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn publish_return<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        channel: &'life1 Channel,
        ret: Return,
        basic_properties: BasicProperties,
        content: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Callback interfaces for asynchronous Channel class message.

See module documentation for general guidelines.

Required Methods§

Source

fn close<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, close: CloseChannel, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle close channel request from server.

Returns Ok to reply server that the request is received and handled properly.

§Errors

If returns Err, no reply to server, which means server won’t know whether the request has been received by client, and may consider the channel isn’t closed.

Source

fn cancel<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, cancel: Cancel, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle server’s request to cancel the consumer of current channel.

Returns Ok to reply server that request has been received and the consumer will be cancelled.

§Errors

If returns Err, no reply to server and no consumer will be cancelled.

Source

fn flow<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, active: bool, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle server’s flow request to pause or restart the flow of sending content data.

if active = true, request to start, otherwise to pause.

Returns true to indicate to server that client starts sending data. Returns false to indicate to server that client stops sending data.

Source

fn publish_ack<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, ack: Ack, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle ack indication from server.

Only occurs in publish confirm mode, sent by server to acknowledges one or more messages published.

Source

fn publish_nack<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, nack: Nack, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle nack indication from server.

Only occurs in publish confirm mode, sent by server to inform publisher of unhandled messages.

Source

fn publish_return<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: &'life1 Channel, ret: Return, basic_properties: BasicProperties, content: Vec<u8>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Callback to handle return indication with undeliverable message from server.

The ret contains the reason why the message is returned.

The basic_properties contains the propertities of the returned message.

The content contains the body of the returned message.

Implementors§