-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathQuoteRequestFlow.cml
76 lines (75 loc) · 3.67 KB
/
QuoteRequestFlow.cml
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
/**
* A RequestStatus is a value object that is used to represent
* the current status of an insurance quote request.
*
* The following diagram shows the possible state transitions:
*
* <pre>
*
* │
* ▼
* ┌────────────┐
* │ REQUEST_ │
* │ SUBMITTED │
* └────────────┘
* │
* ┌─────────────────┴────────────────┐
* │ │
* ▼ ▼
* ┌────────────┐ ╔════════════╗
* │ QUOTE_ │ ║ REQUEST_ ║
* ┌───────────│ RECEIVED │─────────────┐ ║ REJECTED ║
* │ └────────────┘ │ ╚════════════╝
* │ │ │
* │ │ │
* ▼ ▼ ▼
* ╔════════════╗ ┌────────────┐ ╔════════════╗
* ║ QUOTE_ ║ │ QUOTE_ │ ║ QUOTE_ ║
* ║ REJECTED ║ │ ACCEPTED │─────▶║ EXPIRED ║
* ╚════════════╝ └────────────┘ ╚════════════╝
* │
* │
* ▼
* ╔════════════╗
* ║ POLICY_ ║
* ║ CREATED ║
* ╚════════════╝
*
* </pre>
*/
BoundedContext InsuranceQuotes {
Application {
Command SubmitRequest
Flow QuoteRequestFlow {
command SubmitRequest delegates to QuoteRequest[-> SUBMITTED] emits event RequestSubmitted
event RequestSubmitted + RequestSubmitted triggers operation checkRequest
operation checkRequest delegates to QuoteRequest[SUBMITTED -> RECEIVED X REJECTED] emits event QuoteReceived X RequestRejected
event QuoteReceived triggers operation receiveAndCheckQuote
operation receiveAndCheckQuote delegates to QuoteRequest[RECEIVED -> REJECTED X ACCEPTED X EXPIRED] emits event QuoteRejected X QuoteAccepted X QuoteExpired
event QuoteAccepted triggers operation accept
operation accept delegates to QuoteRequest[ACCEPTED -> POLICY_CREATED X EXPIRED] emits event PolicyCreated X QuoteExpired
}
}
Aggregate QuoteRequest {
Entity Request {
aggregateRoot
}
DomainEvent RequestSubmitted
DomainEvent QuoteReceived
DomainEvent RequestRejected
DomainEvent QuoteRejected
DomainEvent QuoteAccepted
DomainEvent QuoteExpired
DomainEvent PolicyCreated
Service QuoteRequestService {
void checkRequest(@Request request);
void receiveAndCheckQuote(@Request request);
void reject(@Request request);
void accept(@Request request);
}
enum RequestState {
aggregateLifecycle
SUBMITTED, RECEIVED, REJECTED, ACCEPTED, EXPIRED, POLICY_CREATED
}
}
}