quickstarts/tutorials/workflow/java/fundamentals
salaboy ca6ace4371 Update tutorials/workflow/java/fundamentals/fundamentals.http
Co-authored-by: Marc Duiker <marcduiker@users.noreply.github.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
2025-08-18 11:48:36 +01:00
..
src Update tutorials/workflow/java/fundamentals/src/main/java/io/dapr/springboot/examples/BasicRestController.java 2025-08-18 11:48:36 +01:00
README.md Update tutorials/workflow/java/fundamentals/README.md 2025-08-18 11:48:36 +01:00
fundamentals.http Update tutorials/workflow/java/fundamentals/fundamentals.http 2025-08-18 11:48:36 +01:00
pom.xml adding external system interactions 2025-08-18 11:48:36 +01:00

README.md

Workflow Basics

This tutorial covers the fundamentals of authoring Dapr Workflows. For more information about the fundamentals of Dapr Workflows, see the Dapr docs.

Inspect the code

Open the BasicWorkflow.java file in the tutorials/workflow/java/task-chaining/src/main/java/io/dapr/springboot/examples/wfp/chain folder. This file contains the definition for the workflow.

The workflow consists of two activities: Activity1 and Activity2, which are called in sequence, where the result of Activity1 is used as an input for Activity2. You can find the Activity definitions in the activities folder.

graph LR
   SW((Start
   Workflow))
   A1[Activity1]
   A2[Activity2]
   EW((End
   Workflow))
   SW --> A1
   A1 --> A2
   A2 --> EW

Run the tutorial

  1. Use a terminal to navigate to the tutorials/workflow/java/fundamentals folder.

  2. Build and run the project using Maven.

    mvn spring-boot:test-run
    
  3. Use the POST request in the fundamentals.http file to start the workflow, or use this cURL command:

    curl -i --request POST "http://localhost:8080/start?input=One"
    

    The input for the workflow is a string with the value This. The expected app logs are as follows:

    i.d.springboot.examples.basic.Activity1  : io.dapr.springboot.examples.basic.Activity1 : Received input: One
    i.d.springboot.examples.basic.Activity2  : io.dapr.springboot.examples.basic.Activity2 : Received input: One Two
    
  4. Use the GET request in the fundamentals.http file to get the status of the workflow, or use this cURL command:

    curl --request GET --url http://localhost:8080/output
    
  5. The expected serialized output of the workflow is:

    One Two Three
    
  6. Stop the application by pressing Ctrl+C.