1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! # Actor-Based Architecture for Lifecycle Components
//!
//! TAS-46: This module implements a lightweight Actor pattern that formalizes
//! the relationship between Commands and Lifecycle Components, providing clear
//! boundaries and better testability without the overhead of a full actor framework.
//!
//! ## Overview
//!
//! The actor pattern here provides:
//! - **Clear Boundaries**: Each lifecycle component becomes an Actor with explicit message handling
//! - **Better Testability**: Actors can be tested in isolation with message-based interfaces
//! - **Supervision Hooks**: Optional lifecycle methods (started/stopped) for resource management
//! - **Consistent Patterns**: All actors follow the same construction and interaction patterns
//!
//! ## Architecture
//!
//! ```text
//! OrchestrationCommand ────→ ActorRegistry ────→ Specific Actor
//! │ │
//! │ ├─→ Handler<M>
//! │ │
//! └──────────────────────┴─→ Lifecycle Component
//! ```
//!
//! ## Key Components
//!
//! - [`OrchestrationActor`]: Base trait for all actors with lifecycle hooks
//! - [`Handler<M>`]: Message handling trait for specific message types
//! - [`Message`]: Marker trait for command messages
//! - [`ActorRegistry`]: Registry managing all orchestration actors
//!
//! ## Usage Example
//!
//! ```rust,no_run
//! use tasker_orchestration::actors::{OrchestrationActor, Handler, Message};
//! use tasker_shared::system_context::SystemContext;
//! use tasker_shared::TaskerResult;
//! use std::sync::Arc;
//! use async_trait::async_trait;
//! use uuid::Uuid;
//!
//! // Define a message
//! pub struct InitializeTaskMessage {
//! pub task_name: String,
//! }
//!
//! impl Message for InitializeTaskMessage {
//! type Response = Uuid;
//! }
//!
//! // Define an actor
//! pub struct TaskRequestActor {
//! context: Arc<SystemContext>,
//! }
//!
//! impl OrchestrationActor for TaskRequestActor {
//! fn name(&self) -> &'static str { "TaskRequestActor" }
//! fn context(&self) -> &Arc<SystemContext> { &self.context }
//! }
//!
//! #[async_trait]
//! impl Handler<InitializeTaskMessage> for TaskRequestActor {
//! type Response = Uuid;
//!
//! async fn handle(&self, msg: InitializeTaskMessage)
//! -> TaskerResult<Uuid> {
//! // Process task request and return UUID
//! Ok(Uuid::new_v4())
//! }
//! }
//! ```
pub
pub
pub
pub
pub
pub
pub
pub
pub
// Re-export message types and traits publicly
pub use ProcessBatchableStepMessage;
pub use OrchestrationCommandProcessorActor;
pub use ;
pub use ActorRegistry;
pub use ProcessStepResultMessage;
pub use ProcessBatchMessage;
pub use FinalizeTaskMessage;
pub use ProcessTaskRequestMessage;
pub use ;