About Eventuate Tram

Eventuate Tram is a framework for managing distributed data in a microservice architecture. It enables a Java application 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 Eventuate Tram Todo application:

Architecture

The application consists of two application services:

  • Todo Service - implements the REST endpoints for creating, updating and deleting todos. The service persists the Todo JPA entity in MySQL. Using Eventuate Tram, it publishes Todo domain events.

  • Todo View Service - implements a REST endpoint for querying the Todos. It maintains a CQRS view of the Todos in ElasticSearch. The Todo View Service subscribes to the events using Eventuate Tram and updates ElasticSearch.

The Todo Service publishes events using Eventuate Tram, which inserts events into the MESSAGE table as part of the ACID transaction that updates the TODO table. 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.