Skip to content
This repository was archived by the owner on Jun 27, 2024. It is now read-only.

Commit 547632d

Browse files
committed
Diagram
1 parent 84b6f77 commit 547632d

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

README.md

+39-10
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,46 @@ Here you can use SwaggerUI to initiate commands that will result in events being
1919

2020
### Example commands
2121

22-
Bookings -> BookRoom (`/bookings/book`)
22+
#### Bookings -> BookRoom (`/bookings/book`)
2323

24-
This command raises an event, which gets stored in the database.
25-
A real-time subscription triggers a projection, which adds or updates two documents in MongoDB: one for the booking and one for the guest.
24+
- This command raises an event, which gets stored in the database.
25+
- A real-time subscription triggers a projection, which adds or updates two documents in MongoDB:
26+
- one for the booking
27+
- one for the guest
2628

27-
Bookings.Payments -> RecordPayment (`/recordPayment`)
29+
#### Bookings.Payments -> RecordPayment (`/recordPayment`)
2830

29-
When this command is executed, it raises a `PaymentRecorded` event, which gets persisted to the database.
30-
A gateway inside the Payments service subscribes to this event and publishes an integration event to RabbitMQ.
31-
An integration RabbitMQ subscription receives the integration event and calls the Bookings service to execute the `RecordPayment` command, so it acts as a Reactor.
32-
When that command gets executed, it raises a `PaymentRecorded` event, which gets persisted to the database. It might also raise a `BookingFullyPaid` or `BookingOverpaid` events, depending on the amount.
33-
Those new events are projected to MongoDB document in the `Bookings` collection using the read-model subscription.
31+
- When this command is executed, it raises a `PaymentRecorded` event, which gets persisted to the database.
32+
- A gateway inside the Payments service subscribes to this event and publishes an integration event to RabbitMQ.
33+
- An integration RabbitMQ subscription receives the integration event and calls the Bookings service to execute the `RecordPayment` command, so it acts as a Reactor.
34+
- When that command gets executed, it raises a `PaymentRecorded` event, which gets persisted to the database. It might also raise a `BookingFullyPaid` or `BookingOverpaid` events, depending on the amount.
35+
- Those new events are projected to MongoDB document in the `Bookings` collection using the read-model subscription.
3436

35-
Bookings.Payments -> `CommandService:RecordPayment` -> `PaymentRecorded` -> `IntegrationSubscription` -> `BookingPaymentRecorded` -> Bookings -> RabbitMQSubscription -> `PaymentsIntegrationHandler` -> `BookingsCommandService:OnExisting<RecordPayment>` -> `V1.PaymentRecorded` -> `BookingState:On<V1.PaymentRecorded>`-> `V1.BookingFullyPaid` -> `BookingStateProjection:On<V1.PaymentRecorded>` -> `BookingStateProjection:On<V1.BookingFullyPaid>`
37+
```mermaid
38+
graph TB
39+
HTTP --> RecordPayment
40+
subgraph Payments
41+
direction LR
42+
RecordPayment -- aggregate --> PaymentRecorded[PaymentRecorded<br>domain event]
43+
Reactor --> PR[PaymentRecorded<br>integration event]
44+
end
45+
subgraph Postgres
46+
PaymentRecorded -- eventstore --> PGSQL[(PGSQL)]
47+
PGSQL -- gateway --> Reactor
48+
end
49+
subgraph Broker
50+
PR --> RabbitMQ[[RabbitmQ]]
51+
end
52+
subgraph Bookings
53+
direction RL
54+
RabbitMQ -- subscription --> IH[Integration<br>handler]
55+
IH --> RP[RecordPayment]
56+
RP -- aggregate --> PR1[PaymentRecorded]
57+
PR1 -- eventstore --> PGSQL
58+
PGSQL -- subscription --> Projections
59+
end
60+
subgraph MongoDB
61+
Projections --> BC[(BookingState)]
62+
Projections --> MB[(MyBookings)]
63+
end
64+
```

0 commit comments

Comments
 (0)