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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! Dispatch helpers for routing events/commands by type URL.
/// Helper macro for dispatching events by type URL suffix.
///
/// Simplifies the common pattern of matching event type URLs and delegating
/// to handler methods.
///
/// # Example
///
/// ```rust,ignore
/// use angzarr_client::dispatch_event;
///
/// impl SagaDomainHandler for OrderSagaHandler {
/// fn execute(
/// &self,
/// source: &EventBook,
/// event: &Any,
/// destinations: &[EventBook],
/// ) -> CommandResult<Vec<CommandBook>> {
/// dispatch_event!(event, source, destinations, {
/// "OrderCompleted" => self.handle_completed,
/// "OrderCancelled" => self.handle_cancelled,
/// })
/// }
/// }
/// ```
///
/// # Variants
///
/// ## For saga execute (source + destinations)
/// ```rust,ignore
/// dispatch_event!(event, source, destinations, {
/// "Suffix" => handler_method,
/// })
/// ```
///
/// ## For saga prepare (source only, returns Vec<Cover>)
/// ```rust,ignore
/// dispatch_event!(event, source, {
/// "Suffix" => prepare_method,
/// })
/// ```
/// Helper macro for dispatching commands by type URL suffix.
///
/// Similar to `dispatch_event!` but for command handler handlers.
///
/// # Example
///
/// ```rust,ignore
/// use angzarr_client::dispatch_command;
///
/// impl CommandHandlerDomainHandler for PlayerHandler {
/// fn handle(
/// &self,
/// cmd: &CommandBook,
/// payload: &Any,
/// state: &PlayerState,
/// seq: u32,
/// ) -> CommandResult<EventBook> {
/// dispatch_command!(payload, cmd, state, seq, {
/// "RegisterPlayer" => self.handle_register,
/// "DepositFunds" => self.handle_deposit,
/// })
/// }
/// }
/// ```
// Macros are exported at crate level via #[macro_export]
// Re-exported from router module for documentation purposes