quickstarts/tutorials/workflow/java/task-chaining
salaboy 4cc708ba91 fixing comments
Signed-off-by: salaboy <Salaboy@gmail.com>
2025-08-18 11:48:36 +01:00
..
src adding fundamentals example 2025-08-18 11:48:36 +01:00
README.md fixing comments 2025-08-18 11:48:36 +01:00
chaining.http Update tutorials/workflow/java/task-chaining/chaining.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

Task Chaining Pattern

This tutorial demonstrates how to chain multiple tasks together as a sequence in a workflow. For more information about the task chaining pattern see the Dapr docs.

Inspect the code

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

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

Run the tutorial

  1. Use a terminal to navigate to the tutorials/workflow/java/task-chaining folder.

  2. Build and run the project using Maven.

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

    curl -i --request POST http://localhost:8080/start
    

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

    io.dapr.workflows.WorkflowContext        : Starting Workflow: io.dapr.springboot.examples.chain.ChainingWorkflow
    i.d.springboot.examples.chain.Activity1  : io.dapr.springboot.examples.chain.Activity1 : Received input: This
    i.d.springboot.examples.chain.Activity2  : io.dapr.springboot.examples.chain.Activity2 : Received input: This is
    i.d.springboot.examples.chain.Activity3  : io.dapr.springboot.examples.chain.Activity3 : Received input: This is task
    
  4. Use the GET request in the chaining.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:

    This is task chaining
    
  6. Stop the application by pressing Ctrl+C.