StreamingProtocol

Trait StreamingProtocol 

Source
pub trait StreamingProtocol: Send + Sync {
    // Required methods
    fn subscribe<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        consumer_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<MessageStream>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn publish<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 str,
        message: ProtocolMessage,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_metadata(&self) -> StreamingMetadata;

    // Provided methods
    fn unsubscribe<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _topic: &'life1 str,
        _consumer_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn is_connected(&self) -> bool { ... }
}
Expand description

Trait for protocols that support streaming and pub/sub patterns

Required Methods§

Source

fn subscribe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, topic: &'life1 str, consumer_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<MessageStream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Subscribe to a topic and return a stream of messages

Source

fn publish<'life0, 'life1, 'async_trait>( &'life0 self, topic: &'life1 str, message: ProtocolMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publish a message to a topic

Source

fn get_metadata(&self) -> StreamingMetadata

Get metadata about the streaming connection

Provided Methods§

Source

fn unsubscribe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _topic: &'life1 str, _consumer_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Unsubscribe from a topic

Source

fn is_connected(&self) -> bool

Check if the connection is healthy

Implementors§