Skip to content

gvdongen/restate-conference-demo-2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Restate Demo: The simplest way to write resilient applications

This is the code repository for the Restate conference talk "The simplest way to write resilient applications".

This presentation was given at:

The code base shows 5 different use cases/patterns that can be implemented with Restate:

  • Workflows/Sagas: SubscriptionService and SubscriptionSaga
  • Concurrent Async Tasks: Email verification
  • Long-running workflows on Kafka: ClaimProcessor
  • Stateful entities: PackageTracker

Running the examples

Run Restate at the root of this repo. Have a look at the installation docs for the installation options:

restate-server --config-file restate.toml

Register the service

restate deployments register http://localhost:9080

Durable Execution: SubscriptionService demo

To the code

Send a request:

curl localhost:8080/SubscriptionService/add \
   --json '{
     "creditCard": "1111-2222-3333-4444",
     "subscriptions": [
       "Prime", "Hulu", "Netflix"
     ],
     "userId": "giselle"
   }'

Check the retries in the UI at localhost:9070.

Remove the RuntimeException in the SubscriptionClient to see the invocation succeed.

Workflows/Sagas: SubscriptionSaga demo

To the code

Send a request

curl localhost:8080/SubscriptionSaga/add \
   --json '{
     "creditCard": "1111-2222-3333-4444",
     "subscriptions": [
       "Prime", "Hulu", "Disney"
     ],
     "userId": "eric"
   }'

Concurrent Async Tasks: Email verification

To the code

Send a request

curl localhost:8080/EmailVerification/verifyEmail \
   --json '{
      "email": "[email protected]",
      "userId": "giselle"
    }'

Running the Kafka examples

Bring up Kafka with the two topics (claims and package-location-updates):

docker compose up -d

Let Restate subscribe to the topic

curl localhost:9070/subscriptions --json '{
    "source": "kafka://my-cluster/claims",
    "sink": "service://ClaimProcessor/submit",
    "options": {"auto.offset.reset": "latest"}
}'
curl localhost:9070/subscriptions --json '{
  "source": "kafka://my-cluster/package-location-updates",
  "sink": "service://PackageTracker/updateLocation",
  "options": {"auto.offset.reset": "latest"}
}'

Long-running workflows on Kafka: ClaimProcessor demo

To the code

Let's submit some posts for two different users:

echo -e 'userid1:{"description": "Fire damage to kitchen", "category": "Property"}' | docker exec -i broker bash -c "kafka-console-producer --bootstrap-server broker:29092 --topic claims --property parse.key=true --property key.separator=:"
echo -e 'userid2:{"description": "Car accident on highway", "category": "Auto"}' | docker exec -i broker bash -c "kafka-console-producer --bootstrap-server broker:29092 --topic claims --property parse.key=true --property key.separator=:"

Stateful entities: PackageTracker demo

To the code

Register a new package via the RPC handler:

curl localhost:8080/PackageTracker/package123/registerPackage \
  --json '{"finalDestination": "Bridge 6, Amsterdam"}'
echo -e 'package123:{"timestamp": "2024-10-10 13:00", "location": "Pinetree Road 5, Paris"}' | docker exec -i broker bash -c "kafka-console-producer --bootstrap-server broker:29092 --topic package-location-updates --property parse.key=true --property key.separator=:"
echo -e 'package123:{"timestamp": "2024-10-10 14:00", "location": "Mountain Road 155, Brussels"}' | docker exec -i broker bash -c "kafka-console-producer --bootstrap-server broker:29092 --topic package-location-updates --property parse.key=true --property key.separator=:"

Query the package location via the RPC handler:

curl localhost:8080/PackageTracker/package123/getPackageInfo | jq .

About

Java demo on Restate for JCON 2025 and Spring I/O 2025

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages