Including Simple Sagas in your project
Include core saga dependencies in your build file:
- Group ID:
io.simplesource
- Artifact ID:
simplesaga-<module>
- Version:
?.?.?
- Latest version in Maven Central, as in above badge.
Where <module>
is one or more of:
saga
- the Saga coordinatorkafka
- the action processorserialization
- serialization helpers (recommended)
Getting the source
Core repo
git clone https://github.com/simplesourcing/simplesaga.git
Scala repo
git clone https://github.com/simplesourcing/simplesaga-scala.git
Pre-requisites
Ensure your local developer machine has the following tools installed
IntelliJ setup
If you choose to use IntelliJ as your IDE, make sure you have the Maven and Lombok plugins installed.
Building the source code
Simply run the following:
make build
Running sample code
The Sample code is now in the Scala Repo
From the project folder for this repo, in separate terminal windows:
- Start kafka stack
docker-compose up
-
Start the command processor, the action processor and the saga coordinator:
sbt "user/runMain io.simplesource.saga.user.all.App"
- Run the client app to submit some saga requests
sbt "user/runMain io.simplesource.saga.user.client.App"
The Kafka topics are created as required.
If it all runs correctly, you should see some console output that ends with some log output:
09:02:24.725 [saga-...] INFO SagaStream - stateTransitionsActionResponse: 1b230f=SagaActionStatusChanged(1b230fc9-fa9b-40f7-8007-01e5831f4d93,a2ad32f5-54b0-43b4-bb24-49678e508c56,Completed)
09:02:24.963 [saga-...] INFO SagaStream - sagaState: 1b230f=InProgress=>5-(e06ac7,Completed)-(719a58,Completed)-(a2ad32,Completed)
09:02:25.222 [saga-...] INFO SagaStream - sagaState: 1b230f=Completed=>6-(e06ac7,Completed)-(719a58,Completed)-(a2ad32,Completed)