liveBook · Manning

Chapter 11: The design of the FTGO 'Create Order saga'

What you will learn in chapter 11 of Microservices Patterns, Second Edition

Introduces the FTGO Create Order saga as a concrete application of earlier saga concepts and outlines the chapter’s design topics.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces the FTGO Create Order saga as a concrete application of earlier saga concepts and outlines the chapter’s design topics.

11.1 An overview of the FTGO Create Order saga

This section previews an examination of the FTGO Create Order saga’s definition, implementing service architecture, and orchestrator framework.

11.1.1 The FTGO Create Order Saga definition

Defines the FTGO Create Order Saga by identifying its transaction phases and how it handles concurrent updates.

Key terms: pivot transaction, compensatable transactions, retriable transactions, consumer, credit card, semantic lock countermeasure, lack of isolation, Order, Ticket

11.1.2 The Create Order Saga's orchestrators design

This section explains why the FTGO Create Order Saga uses a centralized orchestrator in the Order Service and how it coordinates participants through messaging.

Key terms: Create Order Saga, orchestration, choreography, Order Service, orchestrator, Order entity, local operations, request/asynchronous-response, command channel, reply channel

11.1.3 The Eventuate Platform’s Tram Saga framework

This section explains how Eventuate Tram Saga creates and advances the FTGO Create Order Saga, handles participant replies and failures, and routes commands to participants.

Key terms: Eventuate Tram Saga, SimpleSaga, SagaManager, saga orchestration package, OrderService, CreateOrderSagaState, Consumer Service, reply message, Kitchen Service, compensating transactions

11.2 The Create Order Saga orchestrator design

Identifies the main Order Service classes involved in the Create Order Saga and their responsibilities.

Key terms: OrderSagaService, OrderService, POST /orders, CreateOrderSaga, CreateOrderSagaState, SagaParticipantProxy, commands, replies

11.2.1 The OrderSagaService class

This section traces how OrderSagaService starts the Create Order saga in response to a POST /orders request and returns the Order created by its first local step.

Key terms: OrderSagaService, createOrder(), CreateOrderSagaState, SagaInstanceFactory.create(), CreateOrderSaga, first local step

11.2.2 The CreateOrderSaga orchestrator class

This section shows how CreateOrderSaga defines local and cross-service steps, their compensations, and handling of a successful Kitchen Service reply.

Key terms: CreateOrderSaga, SimpleSaga, saga definition, Eventuate Tram Saga, getSagaDefinition(), invokeLocal(), withCompensation(), OrderService, compensating transaction, Kitchen Service

11.2.3 The CreateOrderSagaState class

This section explains how CreateOrderSagaState holds, persists, and supplies application-specific data during the Create Order saga.

Key terms: CreateOrderSagaState, application-specific saga state, Eventuate Tram Saga framework, service command arguments

11.2.4 The OrderService class

This subsection explains how the CreateOrderSaga uses OrderService for local Order operations and outlines what OrderService.createOrder() does.

Key terms: CreateOrderSaga, OrderService, saga proxies, saga participants, createOrder(), Restaurant, Order, domain events, Order aggregate

11.2.5 The saga participant proxy classes

This section explains why the Create Order Saga uses participant proxy classes and illustrates their API and metadata with KitchenServiceProxy.

Key terms: saga participant proxy class, static typed endpoints, Eventuate Spring Wolf, AsyncAPI, KitchenServiceProxy, createTicket(), confirmCreateTicket(), cancelCreateTicket(), CommandWithDestination, @SagaParticipantProxy

11.3 The saga participant command handlers

This section explains how non-local participants in the FTGO Create Order Saga handle commands, using the Kitchen Service as an example.

Key terms: non-local participants, command handler, business logic, createTicket(), KitchenService, @EventuateCommandHandler, subscriberId, Apache Kafka consumer group, command channel

11.4 Summary

Concepts explained in this chapter

← Chapter 10: Saga coordination mechanisms Chapter 12: Using the API Composition pattern to implement system queries →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.