1#![feature(sync_unsafe_cell)]
16#![feature(async_fn_traits)]
17#![feature(unboxed_closures)]
18#![allow(dead_code)]
19
20mod arc_mut;
21mod blocking_queue;
22pub mod count_down_latch;
23pub mod rocketmq_tokio_lock;
24
25mod shutdown;
26pub mod task;
27
28pub mod schedule;
29
30pub use arc_mut::ArcMut;
31pub use arc_mut::SyncUnsafeCellWrapper;
32pub use arc_mut::WeakArcMut;
33pub use blocking_queue::BlockingQueue as RocketMQBlockingQueue;
34pub use count_down_latch::CountDownLatch;
35pub use rocketmq::main;
37pub use rocketmq_tokio_lock::RocketMQTokioMutex;
38pub use rocketmq_tokio_lock::RocketMQTokioRwLock;
39pub use schedule::executor::ExecutorConfig;
40pub use schedule::executor::ExecutorPool;
41pub use schedule::executor::TaskExecutor;
42pub use schedule::scheduler::SchedulerConfig;
43pub use schedule::scheduler::TaskScheduler;
44pub use schedule::task::Task;
45pub use schedule::task::TaskContext;
46pub use schedule::task::TaskResult;
47pub use schedule::task::TaskStatus;
48pub use schedule::trigger::CronTrigger;
49pub use schedule::trigger::DelayTrigger;
50pub use schedule::trigger::DelayedIntervalTrigger;
51pub use schedule::trigger::IntervalTrigger;
52pub use schedule::trigger::Trigger;
53pub use shutdown::Shutdown;
54pub use tokio as rocketmq;
56
57#[cfg(unix)]
60pub async fn wait_for_signal() {
61 use tokio::signal::unix::signal;
62 use tokio::signal::unix::SignalKind;
63 use tracing::info;
64 let mut term = signal(SignalKind::terminate()).expect("failed to register signal handler");
65 let mut int = signal(SignalKind::interrupt()).expect("failed to register signal handler");
66
67 tokio::select! {
68 _ = term.recv() => info!("Received SIGTERM"),
69 _ = int.recv() => info!("Received SIGINT"),
70 }
71}
72
73#[cfg(windows)]
74pub async fn wait_for_signal() {
77 let _ = tokio::signal::ctrl_c().await;
78}