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§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn get_metadata(&self) -> StreamingMetadata
fn get_metadata(&self) -> StreamingMetadata
Get metadata about the streaming connection
Provided Methods§
Sourcefn 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 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
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the connection is healthy