Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Saga Coordinator sample for long-lived transactions using Kafka as the event stream.

License

Notifications You must be signed in to change notification settings

fedeoliv/saga-coordinator-java

Repository files navigation

Saga Coordinator as a Finite State Machine (FSM) in Java

Background

Coordination is a Saga approach where the coordination logic of business processes (e.g. financial transactions) is centralized in a Saga Coordinator, also known as Reactive Orchestrator. It uses the concept of commands and events, where commands are tasks that need to be done and events are tasks that have been done.

The Saga Coordinator produces commands to an event stream and the respective saga participants consume these commands. These participants produce their events after performing their operations and the coordinator consume these Event.

Saga Coordinator

The Saga Coordinator can be implemented as a Finite State Machine (FSM), where it produces commands and waits for events produced by the participants to drive the flow. Events are represented as nodes, while commands are represented as transitions between nodes.

About the sample

The sample contains an FSM Saga Coordinator using Spring Statemachine as the foundation and Confluent Kafka as the distributed streaming platform. The state machine is built with:

Prerequisites

  • Java JDK 8 or later
  • Maven 3.0 or later
  • Confluent Kafka + Zookeper + Schema Registry services running. If you want to run locally as Docker containers, follow the instructions here.
  • Redis instance running. If you want to run locally as Docker container, follow the instructions here.
  • MongoDB instance running. If you want to run locally as Docker container, follow the instructions here.

Getting Started

The lab is divided in the following steps:

About

Saga Coordinator sample for long-lived transactions using Kafka as the event stream.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published