About Eventuate Tram

Eventuate Tram is a platform for managing distributed data in a microservice architecture. It enables a services to send and receive messages as part of an database transaction. It does this by implementing the Transactional outbox pattern. This pattern is foundation of maintaining data consistency within a microservice architecture. It is used to implement the Saga pattern, which implements transactions multiple services, and the CQRS pattern, which implements queries that retrieve data from multiple services.

Eventuate Tram provides several messaging abstractions:

  • messaging - send and receive messages over named channels

  • events - publish and consume domain events

  • commands - asynchronously invoke a service by sending a command message and receiving a reply message

The architecture of an Eventuate Tram application

The following diagram shows the architecture of the hhttps://github.com/eventuate-tram/eventuate-tram-examples-customers-and-orders[Eventuate Tram Customers and Orders application]:

Eventuate Tram Customer and Order Architecture

The application consists of three services:

  • Customer Service - implements a REST API for managing customers. The service persists the Customer JPA entity in a MySQL/Postgres database. Using Eventuate Tram, it publishes Customer domain events that are consumed by the Order Service and the Order History Service.

  • Order Service - implements REST API for managing orders. The service persists the Order JPA entity in MySQL/Postgres database. Using Eventuate Tram, it publishes Order domain events that are consumed by the Customer Service and the Order History Service. The Order Service creates orders using a choreography-based saga that consists of events being exchanged between the Order Service and Customer Service.

  • Order History Service - implements REST API for querying a customer’s order history. This service subscribes to events published by the Order Service and Customer Service and updates a MongoDB-based CQRS view containing the order history.

The Eventuate Tram CDC service reads messages inserted into the MESSAGE table using either Transaction log tailing or Polling and publishes them to a message broker, such as Apache Kafka.

About Eventuate Tram Sagas

Eventuate Tram sagas builds on Eventuate Tram to provide orchestration-based sagas. Instead of simply relying on services to respond to domain events, you define a saga orchestrator, which tells the saga participants what operations to execute. To understand the difference between choreography using domain events and orchestration, please read this article and see this presentation.