This example shows a subset of a ticket booking system.
Restate is a system for easily building resilient applications using distributed durable building blocks.
❓ Learn more about Restate from the Restate documentation.
To set up the example, use the following sequence of commands.
Setup the virtual env:
python3 -m venv .venv
source .venv/bin/activate
Install the requirements:
pip install -r requirements.txt
Start the app as follows:
python3 -m hypercorn example/app:app
Start the Restate Server (other options here):
restate-server
Register the service:
restate dp register http://localhost:8000
Then add a ticket to Mary's cart:
curl localhost:8080/cart/Mary/add_ticket -H 'content-type: application/json' -d '"seat2B"'
Let Mary buy the ticket via:
curl -X POST localhost:8080/cart/Mary/checkout
That's it! We managed to run the example, add a ticket to the user session cart, and buy it!