Crate schedule_flows
source ·Expand description
Make flow function acting as scheduled task in Flows.network
Quick Start
To get started, let’s write a task that will send a message to Slack at a fixed time wach day.
use schedule_flows::{schedule_cron_job, schedule_handler};
use slack_flows::send_message_to_channel;
#[no_mangle]
#[tokio::main(flavor = "current_thread")]
pub async fn on_deploy() {
schedule_cron_job(String::from("50 8 * * *"), String::from("cron_job_evoked")).await;
}
#[schedule_handler]
async fn handler(body: Vec<u8>) {
send_message_to_channel(
"myworkspace",
"mychannel",
String::from_utf8_lossy(&body).into_owned(),
).await
}
schedule_cron_job() will create a cron job. The handler
decorated by macro schedule_handler
will be called when the job is evoked at 8:50 UTC each day.
Functions
- Create a cron job.