Restate is a system for easily building resilient applications, workflows, asynchronous tasks, and event-driven applications.
This example contains the code for the Tour of Restate
tutorial, for the Python API.
This tutorial takes your through key Restate features by developing an end-to-end ticketing app.
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:
python -m hypercorn --config hypercorn-config.toml tour/app/app:app
Start the Restate Server (other options here):
restate-server
Register the service:
restate deployments register http://localhost:9080
Then add a ticket to Mary's cart:
curl localhost:8080/CartObject/Mary/addTicket -H 'content-type: application/json' -d '"seat2B"'
Let Mary buy the ticket via:
curl -X POST localhost:8080/CartObject/Mary/checkout
That's it! We managed to run the example, add a ticket to the user session cart, and buy it!