Custom Executor
Last updated
use clique_proc_macro::{executor, namespace};
#[namespace(name = "yourOrganization")]
pub mod task_mod1 {
#[task]
pub struct HttpsRequest;
#[clique::async_trait]
impl clique::Task for HttpsRequest {
type Error = anyhow::Error;
async fn execute(
input: Self::Input,
) -> Result<Self::Output, Self::Error> {
let url = input.url;
let encoding = input.encoding;
for transformation in encoding.into_iter() {
let json_ptr_str: String = transformation.from;
let soltype_str: String = transformation.soltype;
// ...
}
let response: Vec<u8> = // ...
let output = HttpsRequestOutput { response };
Ok(output)
}
}
#[task]
pub struct HttpsRequest2;
#[clique::async_trait]
impl clique::Task for HttpsRequest2 {
type Error = anyhow::Error;
async fn execute(
input: Self::Input,
) -> Result<Self::Output, Self::Error> {
// ...
}
}
}
#[namespace(name = "yourOrganization")]
pub mod task_mod2 {
#[task]
pub struct AnotherTask;
#[clique::async_trait]
impl clique::Task for AnotherTask {
type Error = anyhow::Error;
async fn execute(
input: Self::Input,
) -> Result<Self::Output, Self::Error> {
// ...
}
}
}
#[executor(with(
task_mod1,
task_mod2,
))]
pub struct MyCustomExecutor;