1use aj::{
2 async_trait,
3 export::core::{
4 actix_rt::time::sleep,
5 serde::{Deserialize, Serialize},
6 },
7 main, BackgroundJob, Executable, JobContext, AJ,
8};
9use aj_core::get_now_as_secs;
10
11#[derive(BackgroundJob, Serialize, Deserialize, Debug, Clone)]
12pub struct AJob;
13
14#[async_trait]
15impl Executable for AJob {
16 type Output = ();
17
18 async fn execute(&mut self, _context: &JobContext) -> Self::Output {
19 println!("Hello Job {}", get_now_as_secs());
20 }
21}
22
23#[main]
24async fn main() {
25 AJ::quick_start();
26
27 println!("Start time {}", get_now_as_secs());
28 let _ = AJob.job().cron("* * * * * * *").run().await;
29
30 sleep(std::time::Duration::from_secs(5)).await;
31}