Skip to content

pvsone/temporal-trip-booking

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temporal Trip Booking

Overview

The Temporal trip booking workflow is responsible for coordinating the booking of a vacation package, consisting of a car, hotel, and flight reservation. In the event of a failure at any point during the booking process, the workflow will trigger compensating actions to undo any previous bookings. This is an implementation of a Saga pattern. A Saga ensures that a business process is atomic, that is, it executes observably equivalent to completely or not at all.

Running

Prerequisites:

With this repository cloned, run the following at the root of the directory:

poetry install --no-root

That loads all required dependencies.

Then run the worker and workflow.

cd app-python
./start_worker.sh

cd ui
./start_ui.sh

Demo: Happy Path

Enter your booking information in the Flask app http://127.0.0.1:5000, then see the tasks in the Web UI at http://localhost:8233/.

Demo: Durable Path

Use ctrl+c to kill the worker process at any time during workflow execution. Restart the worker to resume the function execution in a new process.

Demo: Recover Forward (retries)

Add the word "Flaky" to the Car input field. The car booking activity will fail 5 times, and succeed on the 6th attempt.

Demo: Recover Forward (bug in code)

Add the word "Buggy" to the Hotel input field. The hotel booking activity will fail indefinitely - until the bug in the activity function is fixed, and the worker is restarted.

Demo: Recover Backward (rollback)

Add the word "Invalid" to the Flight input field. The flight booking activity will fail with and non-retryable error, and the hotel and car bookings will be rolled back.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 42.9%
  • Go 34.4%
  • HTML 21.9%
  • Shell 0.8%