Crash-Free Spring PetClinic
- Learning Temporal and Durable Execution by Growing an App You Already Know
Chapter 1: Introduction
- What Temporal is, and the problem it solves
- Why PetClinic is the perfect teacher
- How the book works
- The arc of the book
- What you need
- How to read it
Chapter 2: Your First Workflow and Activity
- What a Workflow, an Activity, and a Worker are
- Step 1: Start a local Temporal server
- Step 2: Add the Temporal Spring Boot starter
- Step 3: Point the app at Temporal and enable a Worker
- Step 4: Define the Activity
- Step 5: Define the Workflow
- Step 6: Start the Workflow from the controller
- Step 7: Build and run
- Step 8: Verify the Worker is polling
- Step 9: Book a visit and watch it run
- What you gained
Chapter 3: Orchestrating Multiple Activities
- The goal
- Step 1: Add the second Activity to the interface
- Step 2: Implement it
- Step 3: Call it from the Workflow with its own retry policy
- Step 4: Rebuild, restart, and book a visit
- Step 5: Confirm both Activities in the event history
- What this bought you
- Where to go next
Chapter 4: Checking a Pet In with Signals
- What a Signal is
- Step 1: Add a Signal method to the Workflow interface
- Step 2: Wait for the Signal in the implementation
- Step 3: Send the Signal from the controller
- Step 4: From the CLI
- What to watch in the Web UI
- What you gained
Chapter 5: Asking a Booking Its Status with Queries
- What a Query is
- Step 1: Add a Query method to the interface
- Step 2: Expose state from the implementation
- Step 3: Query from the controller
- Step 4: From the CLI
- A caveat worth internalizing
- What you gained
Chapter 6: Approving a Change with Updates
- What an Update is
- Step 1: Declare the Update and its validator
- Step 2: Implement the validator and the handler
- Step 3: Call the Update from the controller
- Step 4: From the CLI
- Signals vs. Queries vs. Updates
- What you gained
Chapter 7: Sending Reminders with Durable Timers
- What a durable Timer is
- Step 1: Compute the delay and sleep
- Step 2: Add the reminder Activity
- Step 3: Combine timers with Signals
- Watching it in the Web UI
- The catch worth stating plainly
- What you gained
Chapter 8: Handling Failure the Temporal Way
- The default, and why you tune it
- Step 1: Mark a failure non-retryable at the source
- Step 2: Exclude failure types in the retry policy
- Step 3: React to failure in the Workflow
- Timeouts are failures too
- Debugging a failure in the Web UI
- What you gained
Chapter 9: Billing a Visit with the Saga Pattern
- What the Saga pattern is
- Step 1: Model the forward steps and their compensations as Activities
- Step 2: Drive the Saga from the Workflow
- Step 3: Compensations should be idempotent
- Step 4: Watch a rollback happen
- Why this beats a hand-rolled rollback
- What you gained
Chapter 10: Booking Many Pets with Child Workflows
- What a Child Workflow is
- Step 1: The child is just a Workflow
- Step 2: The parent starts one child per pet
- Step 3: Parent and child lifecycles —
ParentClosePolicy - Step 4: Getting results back
- Watching it in the Web UI
- What you gained
Chapter 11: Never-Ending Reminders with Continue-As-New
- What continue-as-new is
- Step 1: Do a bounded chunk of work, then continue
- Step 2: When to continue
- Step 3: Signals and continue-as-new — drain first
- Watching it in the Web UI
- What you gained
Chapter 12: Recurring Checkups with Schedules and Cron
- What a Schedule is
- Step 1: The Workflow being scheduled is ordinary
- Step 2: Create a Schedule with the client
- Step 3: Operating a Schedule
- Step 4: Overlap policy
- Watching it in the Web UI
- Schedule vs. continue-as-new
- What you gained
Chapter 13: Evolving Workflows Safely with Versioning
- Why replay makes this hard
- Approach 1:
Workflow.getVersionfor in-place changes - Approach 2: Worker Versioning for whole-Workflow changes
- What is safe to change without versioning
- Testing for non-determinism before you deploy
- Watching a non-determinism error
- What you gained
Chapter 14: Long-Running Work with Heartbeats and Cancellation
- Why a long Activity needs a heartbeat
- Step 1: Heartbeat from a long Activity
- Step 2: Configure the heartbeat timeout
- Step 3: Cancellation — stopping work that is no longer wanted
- Step 4: Cancelling from the Workflow or client
- Watching it in the Web UI
- What you gained
Chapter 15: Finding Visits with Search Attributes
- What Search Attributes are
- Step 1: Register the custom attributes
- Step 2: Set attributes when starting the Workflow
- Step 3: Update an attribute as the Workflow progresses
- Step 4: Search
- Built-in attributes you already have
- A note on the dev server
- What you gained
Chapter 16: Testing Workflows with Confidence
- The test framework in one breath
- Step 1: Test a Workflow with mocked Activities
- Step 2: Test a durable timer without waiting
- Step 3: Test Signals, Queries, and Updates
- Step 4: Replay testing — the guard against non-determinism
- Step 5: Activities can be unit-tested plainly
- What you gained
Chapter 17: Seeing Inside Workflows with OpenTelemetry
- Why this is the right closing chapter
- How Temporal traces work
- Step 1: Add the OpenTelemetry dependencies
- Step 2: Build the interceptor and register it
- Step 3: Point OTLP at a backend
- Step 4: Read a booking as a trace
- What OTel adds over the Web UI
- What you gained, and where the book leaves you