Skip to main content

rsiot/components/cmp_influxdb3/
component.rs

1use async_trait::async_trait;
2
3use tracing::error;
4
5use crate::{
6    components::cmp_logger::COMPONENT_NAME,
7    executor::{Component, ComponentError, IComponentProcess, MsgBusLinker},
8    message::MsgDataBound,
9};
10
11use super::{Config, fn_process::fn_process};
12
13#[cfg_attr(not(feature = "single-thread"), async_trait)]
14#[cfg_attr(feature = "single-thread", async_trait(?Send))]
15impl<TMsg> IComponentProcess<Config<TMsg>, TMsg> for Component<Config<TMsg>, TMsg>
16where
17    TMsg: MsgDataBound + 'static,
18{
19    async fn process(
20        &self,
21        config: Config<TMsg>,
22        msgbus_linker: MsgBusLinker<TMsg>,
23    ) -> Result<(), ComponentError> {
24        fn_process(msgbus_linker.init(COMPONENT_NAME), config).await?;
25        error!("Influxdb client component end execution");
26        Ok(())
27    }
28}
29
30/// Компонент cmp_influxdb
31pub type Cmp<TMsg> = Component<Config<TMsg>, TMsg>;