Skip to content

Commit f2f369a

Browse files
committed
Added GitHub action for distributed processes samples
1 parent 3a75d1d commit f2f369a

4 files changed

Lines changed: 62 additions & 2 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Samples - EventStoreDB Events Versioning
2+
3+
on:
4+
# run it on push to the default repository branch
5+
push:
6+
branches: [main]
7+
paths:
8+
- "samples/distributed-processes/**"
9+
# run it during pull request
10+
pull_request:
11+
paths:
12+
- "samples/distributed-processes/**"
13+
14+
defaults:
15+
run:
16+
working-directory: samples/distributed-processes
17+
18+
jobs:
19+
build-and-test-code:
20+
name: Build and test
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Check Out Repo
25+
uses: actions/checkout@v2
26+
27+
- name: Start containers
28+
run: docker-compose up -d
29+
30+
- name: Set up JDK 17
31+
uses: actions/setup-java@v2
32+
with:
33+
java-version: 17
34+
distribution: "adopt"
35+
cache: gradle
36+
37+
- uses: gradle/gradle-build-action@v2
38+
with:
39+
arguments: build
40+
gradle-version: wrapper
41+
build-root-directory: samples/distributed-processes
42+
43+
- name: Archive test report
44+
uses: actions/upload-artifact@v2
45+
if: always()
46+
with:
47+
name: Test report
48+
path: ./samples/distributed-processes/build/test-results/test
49+
50+
- name: Stop containers
51+
if: always()
52+
run: docker-compose down

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ Shows how to handle unique constraint checks in an event-sources system. Explain
294294
Read more in [How to ensure uniqueness in Event Sourcing](https://event-driven.io/en/uniqueness-in-event-sourcing/?utm_source=event_sourcing_jvm).
295295

296296
### [Distributed Processes](./samples/distributed-processes/)
297-
Shows how to handle distibuted processes in Event Sourcing in practice. Explains various use cases, like:
297+
Shows how to handle distributed processes in Event Sourcing in practice. Explains various use cases, like:
298298
- batch processing,
299299
- saga vs process managers,
300300
- distributed processes in the single module and across boundaries,

samples/distributed-processes/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
# Distributed process with Event Sourcing
2+
3+
- [Distributed process with Event Sourcing](#distributed-process-with-event-sourcing)
4+
- [Batch operations](#batch-operations)
5+
- [Cross-module processes with compensation](#cross-module-processes-with-compensation)
6+
17
Those samples present how you can tackle handling distributed processes in Event Sourcing. For more background, check my article [Saga and Process Manager - distributed processes in practice](https://event-driven.io/en/saga_process_manager_distributed_transactions?utm_source=event_sourcing_jvm).
8+
29
Distributed processes with an event-driven approach embrace the impossibility of the two-phase commit in distributed transactions. Instead of trying to make a big transaction across modules and databases, it does a sequence of _microtransactions_. Each operation is handled by the module that's the source of truth and can make autonomous decisions. The distributed process is triggered by the event registered and published in the system, e.g. shopping cart confirmed. Then another module can subscribe to it and take it from there. It knows what should be the next operation, e.g. initiating the order process. It sends a command that is handled, and business logic creates another event. This event is the trigger for the next step of the workflow. Such _lasagne_ of event/command/event/command continues until the process is finished (with success or failure).
310

411
![lasagne](./assets/lasagne.png)
@@ -117,7 +124,7 @@ See more in [ESDBCommandBus.java](./src/main/java/io/eventdriven/distributedproc
117124

118125
The business logic of the saga processing is delegated to aggregate. Thanks to that, we have a clear split of responsibility between coordination (saga) and business logic (aggregate). Thanks to that, the saga is lightweight and much easier to maintain than merging both into Process Manager.
119126

120-
See the in [GroupCheckout](./src/main/java/io/eventdriven/distributedprocesses/hotelmanagement/groupcheckout/GroupCheckout.java]() aggregate.
127+
See the in [GroupCheckout](./src/main/java/io/eventdriven/distributedprocesses/hotelmanagement/groupcheckout/GroupCheckout.java) aggregate.
121128

122129
We can check out the guest account if the balance is settled. If it's not, then it will store the failure event:
123130

@@ -284,4 +291,5 @@ Each module:
284291
- [orders](./src/main/java/io/eventdriven/distributedprocesses/ecommerce/orders/),
285292
- [payments](./src/main/java/io/eventdriven/distributedprocesses/ecommerce/payments/),
286293
- [shipments](./src/main/java/io/eventdriven/distributedprocesses/ecommerce/shipments/).
294+
287295
can use dedicated event store streams to publish their external events, e.g. _'shopping_carts__external-events'_. Other modules can subscribe to those streams and take it from there. It is a similar concept to Kafka's topics.

samples/distributed-processes/gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)