-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynapse.http
122 lines (97 loc) · 3.19 KB
/
synapse.http
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
### Register command hanlder for `default` context / Create or Update command handler registration
PUT http://localhost:8080/v1/contexts/default/handlers/commands/7ec558ec-90c4-4d51-b444-a028830257bb
Content-Type: application/json
{
"names": [
"IssueGiftCardCommand", "RedeemGiftCardCommand", "CancelGiftCardCommand"
],
"endpoint": "http://localhost:3000/commands",
"endpointType": "http-raw",
"clientId": "giftcard-demo-1",
"componentName": "Giftcard"
}
### Send commands (over Axon Synapse) to default context
POST http://localhost:8080/v1/contexts/default/commands/IssueGiftCardCommand
Content-Type: application/json
AxonIQ-PayloadType: IssueGiftCardCommand
AxonIQ-RoutingKey: 10fca0c4-3376-4ca2-a7c2-db2b75c250ff
{
"kind": "IssueGiftCardCommand",
"id": "10fca0c4-3376-4ca2-a7c2-db2b75c250ff",
"amount": 550
}
###
POST http://localhost:8080/v1/contexts/default/commands/RedeemGiftCardCommand
Content-Type: application/json
AxonIQ-PayloadType: RedeemGiftCardCommand
AxonIQ-RoutingKey: 10fca0c4-3376-4ca2-a7c2-db2b75c250ff
{
"kind": "RedeemGiftCardCommand",
"id": "10fca0c4-3376-4ca2-a7c2-db2b75c250ff",
"amount": 34
}
### Register Event Handler(s)
PUT http://localhost:8080/v1/contexts/default/handlers/events/08a08dc4-0057-45e8-9291-9a47ffb09e52
Content-Type: application/json
{
"names": [
"GiftCardIssuedEvent", "GiftCardRedeemedEvent", "GiftCardCancelledEvent"
],
"endpoint": "http://localhost:3000/events",
"endpointType": "http-raw",
"clientId": "giftcard-demo-1",
"componentName": "Giftcard"
}
### Send events (over Axon Synapse) to default context
POST http://localhost:8080/v1/contexts/default/events/GiftCardIssuedEvent
AxonIQ-AggregateId: 10fca0c4-3376-4ca2-a7c2-db2b75c250e0
AxonIQ-AggregateType: Giftcard
AxonIQ-SequenceNumber: 0
Content-Type: application/json
{
"kind": "GiftCardIssuedEvent",
"id": "10fca0c4-3376-4ca2-a7c2-db2b75c250e0",
"amount": 550
}
###
POST http://localhost:8080/v1/contexts/default/events/GiftCardRedeemedEvent
AxonIQ-AggregateId: 10fca0c4-3376-4ca2-a7c2-db2b75c250e0
AxonIQ-AggregateType: Giftcard
AxonIQ-SequenceNumber: 1
Content-Type: application/json
{
"kind": "GiftCardRedeemedEvent",
"id": "10fca0c4-3376-4ca2-a7c2-db2b75c250e0",
"amount": 52
}
### Register query hanlder for `default` context / Create or Update query handler registration
PUT http://localhost:8080/v1/contexts/default/handlers/queries/9ec558ec-90c4-4d51-b444-a028830257aa
Content-Type: application/json
{
"names": [
"FindByIdQuery", "FindAllQuery"
],
"endpoint": "http://localhost:3000/queries",
"endpointType": "http-raw",
"clientId": "giftcard-demo-1",
"componentName": "Giftcard"
}
### Send queries (over Axon Synapse) to default context
POST http://localhost:8080/v1/contexts/default/queries/FindByIdQuery
Content-Type: application/json
AxonIQ-PayloadType: FindByIdQuery
AxonIQ-ResponseCardinality: single
AxonIQ-ResponseType: GiftCardSummary
{
"kind": "FindByIdQuery",
"id": "10fca0c4-3376-4ca2-a7c2-db2b75c250ff"
}
###
POST http://localhost:8080/v1/contexts/default/queries/FindAllQuery
Content-Type: application/json
AxonIQ-PayloadType: FindAllQuery
AxonIQ-ResponseCardinality: multiple
AxonIQ-ResponseType: GiftCardSummary
{
"kind": "FindAllQuery"
}