Skip to content

Commit ce0edde

Browse files
committed
docs: convert notifier into process manager
1 parent e857a29 commit ce0edde

5 files changed

Lines changed: 90 additions & 49 deletions

File tree

domain/activity-sampling/actors.esdm.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,15 @@ responsibilities:
3535
- Receives calendar updates from the external system and triggers synchronization commands.
3636
backedBy:
3737
- calendar
38+
---
39+
apiVersion: schema.esdm.io/core/v1
40+
kind: actor
41+
name: notifier
42+
scope:
43+
domain: activity-sampling
44+
boundedContext: activity-sampling
45+
type: system
46+
responsibilities:
47+
- Show notification to the user when the current interval has elapsed.
48+
backedBy:
49+
- notifications

domain/activity-sampling/logged-activity.esdm.yaml

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,39 @@ state:
3030
---
3131
apiVersion: schema.esdm.io/core/v1
3232
kind: command
33+
name: log-activity
34+
scope:
35+
domain: activity-sampling
36+
boundedContext: activity-sampling
37+
aggregate: logged-activity
38+
data:
39+
type: object
40+
properties:
41+
timestamp:
42+
type: string
43+
format: date-time
44+
duration:
45+
type: string
46+
format: duration
47+
client:
48+
type: string
49+
project:
50+
type: string
51+
task:
52+
type: string
53+
notes:
54+
type: string
55+
category:
56+
type: string
57+
required: [timestamp, duration, client, project, task]
58+
publishes:
59+
- activity-logged
60+
actors:
61+
- software-developer
62+
- notifier
63+
---
64+
apiVersion: schema.esdm.io/core/v1
65+
kind: command
3366
name: export-timesheet
3467
scope:
3568
domain: activity-sampling
@@ -65,38 +98,6 @@ actors:
6598
- software-developer
6699
---
67100
apiVersion: schema.esdm.io/core/v1
68-
kind: command
69-
name: log-activity
70-
scope:
71-
domain: activity-sampling
72-
boundedContext: activity-sampling
73-
aggregate: logged-activity
74-
data:
75-
type: object
76-
properties:
77-
timestamp:
78-
type: string
79-
format: date-time
80-
duration:
81-
type: string
82-
format: duration
83-
client:
84-
type: string
85-
project:
86-
type: string
87-
task:
88-
type: string
89-
notes:
90-
type: string
91-
category:
92-
type: string
93-
required: [timestamp, duration, client, project, task]
94-
publishes:
95-
- activity-logged
96-
actors:
97-
- software-developer
98-
---
99-
apiVersion: schema.esdm.io/core/v1
100101
kind: event
101102
name: activity-logged
102103
scope:
@@ -122,6 +123,8 @@ data:
122123
type: string
123124
category:
124125
type: string
126+
notification:
127+
type: string
125128
required: [timestamp, duration, client, project, task]
126129
---
127130
apiVersion: schema.esdm.io/core/v1

domain/activity-sampling/timer.esdm.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ data:
5858
duration:
5959
type: string
6060
format: duration
61-
elapsedTime:
61+
progressedTime:
6262
type: string
6363
format: duration
6464
timestamp:
@@ -68,7 +68,8 @@ data:
6868
required: [isElapsed, duration]
6969
constraints:
7070
- name: tick-or-elapse
71-
rule: If isElapsed is true, timestamp must be provided, otherwise elapsedTime must be provided.
71+
rule:
72+
If isElapsed is true, timestamp must be provided, otherwise progressedTime must be provided.
7273
publishes:
7374
- ticked
7475
- elapsed
@@ -116,13 +117,13 @@ data:
116117
properties:
117118
timer:
118119
type: string
119-
elapsedTime:
120+
progressedTime:
120121
type: string
121122
format: duration
122123
duration:
123124
type: string
124125
format: duration
125-
required: [timer, elapsedTime, duration]
126+
required: [timer, progressedTime, duration]
126127
---
127128
apiVersion: schema.esdm.io/core/v1
128129
kind: event
@@ -136,10 +137,12 @@ data:
136137
properties:
137138
timer:
138139
type: string
140+
notification:
141+
type: string
139142
timestamp:
140143
type: string
141144
format: date-time
142145
duration:
143146
type: string
144147
format: duration
145-
required: [timer, timestamp, duration]
148+
required: [timer, notification, timestamp, duration]

domain/external-systems.esdm.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ name: calendar
44
scope:
55
domain: activity-sampling
66
direction: inbound
7-
category: calendar
8-
capabilities:
9-
- Provides information about holidays and vacations.
107
---
118
apiVersion: schema.esdm.io/core/v1
129
kind: external-system
1310
name: timesheet
1411
scope:
1512
domain: activity-sampling
1613
direction: outbound
17-
category: csv-export
14+
---
15+
apiVersion: schema.esdm.io/core/v1
16+
kind: external-system
17+
name: notifications
18+
scope:
19+
domain: activity-sampling
20+
direction: bidirectional
Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
apiVersion: schema.esdm.io/core/v1
2-
kind: event-handler
2+
kind: process-manager
33
name: notifier
44
scope:
55
domain: activity-sampling
66
deliveryGuarantee: at-most-once
7-
handles:
8-
- boundedContext: activity-sampling
9-
aggregate: logged-activity
10-
event: activity-logged
7+
correlatedBy:
8+
source: event-field
9+
field: notification
10+
state:
11+
type: object
12+
properties:
13+
lastActivity:
14+
type: LoggedActivity
15+
startsWhen:
1116
- boundedContext: activity-sampling
1217
aggregate: timer
1318
event: elapsed
14-
sideEffects:
15-
- type: other
16-
rule: Notify the user that the current interval has elapsed.
19+
endsWhen:
20+
- name: close-notification
21+
condition: The notification is closed.
22+
reactions:
23+
- when:
24+
boundedContext: activity-sampling
25+
aggregate: logged-activity
26+
event: activity-logged
27+
rule: Store last activity.
28+
- when:
29+
boundedContext: activity-sampling
30+
aggregate: timer
31+
event: elapsed
32+
rule: Show notification with last activity.
33+
emits:
34+
- boundedContext: activity-sampling
35+
aggregate: logged-activity
36+
command: log-activity

0 commit comments

Comments
 (0)