testeventbus::traits::controller

Trait EventBus

Source
pub trait EventBus<T: Debug + Serialize + for<'de> Deserialize<'de>>: Producer<T> + Consumer<T> {
    // Required methods
    fn new<'async_trait>(    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
       where Self: Sized + 'async_trait;
    fn new_config<'async_trait>(
        connection_config: ConnectionConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
       where Self: Sized + 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn new<'async_trait>() -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,

§返回

返回初始化后的 EventBus 本身。

Source

fn new_config<'async_trait>( connection_config: ConnectionConfig, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: Sized + 'async_trait,

§参数
  • connection_config: 连接配置。
§返回

返回初始化后的 EventBus 本身。

Source

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

关闭生产者

§返回

如果成功返回 Ok(()),否则返回错误。

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

健康检查接口

§返回

如果健康返回 Ok(()),否则返回错误。

Implementors§

Source§

impl<T> EventBus<T> for NatsCli<T>
where T: Clone + Serialize + for<'de> Deserialize<'de> + Debug + Send + Sync + 'static,