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
use crate::;
/// A top-level message envelope for routing through the message bus.
///
/// The `Message` enum represents the three primary types of messages that can
/// be processed by the message bus:
///
/// - `Command`: An intent to change domain state, handled via a `UnitOfWork`.
/// - `Event`: A fact that something has already happened, emitted by the domain and
/// passed to `Policy` implementations.
/// - `Projection`: A side-effect-only message used to update external systems,
/// handled by a `Projector`.
///
/// This enum is used internally to represent all message types in transit across
/// the system. Each variant will be routed to the appropriate handler based on
/// its type.
/// A type alias for a fully typed message handled by the message bus.
///
/// `DriverMessage` resolves the concrete command, event, and projection types
/// using the associated types provided by a `MessageBusDriver`. This alias is
/// used by the broker, dispatcher, and internal routing logic to work generically
/// across all message variants.
pub type DriverMessage<D> = ;
/// A message produced as a side effect of a domain event.
///
/// A `SideEffect` is a result of applying a `Policy` to a domain event. It may
/// include one or more follow-up actions:
///
/// - `Command`: A new command to be handled by the domain.
/// - `Projection`: A projection message to be sent to an external system.
///
/// These side effects will be published to the message bus and routed as if they
/// had been received externally.
pub type DriverSideEffect<D> =
;