Skip to content

Spring boot workflow patterns examples with mechanical markdown and tests #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

salaboy
Copy link
Collaborator

@salaboy salaboy commented May 16, 2025

Description

Adding separate module for Workflow Patterns

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1344

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@salaboy salaboy requested review from a team as code owners May 16, 2025 09:06
@salaboy salaboy force-pushed the adding-wf-examples-to-sb branch 3 times, most recently from 4008dcd to cacbe04 Compare May 16, 2025 11:36
@salaboy salaboy changed the title [WIP] Spring boot workflow patterns initial version Spring boot workflow patterns initial version May 16, 2025
@salaboy salaboy changed the title Spring boot workflow patterns initial version Spring boot workflow patterns examples with mechanical markdown and tests May 16, 2025
@salaboy
Copy link
Collaborator Author

salaboy commented May 16, 2025

@dapr/maintainers-java-sdk please review and add suggestions if you have them.

@salaboy salaboy force-pushed the adding-wf-examples-to-sb branch 2 times, most recently from e275c5f to abf72c4 Compare May 16, 2025 14:36
* Run Fan Out/in Demo Workflow
* @return confirmation that the workflow instance was created for the workflow pattern faninout
*/
@PostMapping("wfp/fanoutin")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull out the different patterns here to their respective folder? It will be cleaner to users to have 1 clear example per pattern rather than a shared file used by all examples.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples are all in different folders, this is just the access point. I can create separate applications per pattern (as it is done in the Dapr University) but that sounds like an overkill for the samples app

@@ -0,0 +1,40 @@
/*
* Copyright 2023 The Dapr Authors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you rename this directory from fanoutin to faninout since that is the name of the example from here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cicoyle the example is fanning out tasks to then do a fan-in.. I think the original example name was wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also aligned with how the Dapr University is doing it: https://github.com/dapr/quickstarts/tree/master/tutorials/workflow/csharp/fan-out-fan-in

@@ -0,0 +1,51 @@
/*
* Copyright 2023 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this filename: fanoutin -> faninout

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cicoyle the example is fanning out tasks to then do a fan-in.. I think the original example name was wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also aligned with how the Dapr University is doing it: https://github.com/dapr/quickstarts/tree/master/tutorials/workflow/csharp/fan-out-fan-in


assertEquals(5, cleanUpLog.getCleanUpTimes());
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you delete this if its an empty file: spring-boot-examples/workflows/src/test/resources/application.properties?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that we do in spring applications, if you want to customize the app configuration, that file needs to be there to accept properties. Instead of deleting it, I will add the spring boot app name to follow what https://start.spring.io/ is doing.


The Parent workflow looks like this:

```mermaid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to put mermaid here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cicoyle yes.. can you please elaborate on the question?

cicoyle and others added 12 commits May 17, 2025 11:01
…apr#1361)

* feat: Support for GRPC ssl

Signed-off-by: Javier Aliaga <[email protected]>

* add tests

Signed-off-by: Cassandra Coyle <[email protected]>

* fix CI

Signed-off-by: Cassandra Coyle <[email protected]>

* add back else if

Signed-off-by: Cassandra Coyle <[email protected]>

* channel cleanup

Signed-off-by: Cassandra Coyle <[email protected]>

* add root ca support

Signed-off-by: Cassandra Coyle <[email protected]>

* checkstyles

Signed-off-by: Cassandra Coyle <[email protected]>

* add insecure

Signed-off-by: Cassandra Coyle <[email protected]>

* fix checkstyles

Signed-off-by: Cassandra Coyle <[email protected]>

* use InsecureTrustManagerFactory

Signed-off-by: Cassandra Coyle <[email protected]>

* fix test

Signed-off-by: Cassandra Coyle <[email protected]>

---------

Signed-off-by: Javier Aliaga <[email protected]>
Signed-off-by: Cassandra Coyle <[email protected]>
Co-authored-by: Javier Aliaga <[email protected]>
Signed-off-by: salaboy <[email protected]>
Signed-off-by: salaboy <[email protected]>
… Workflows (dapr#1343)

* Add coverage for some properties (dapr#1297)

Signed-off-by: sirivarma <[email protected]>

* Make the DAPR version being used consistent across all tests (dapr#1299)

Signed-off-by: sirivarma <[email protected]>

* Separate Dapr constants from IT container constants (dapr#1315)

Signed-off-by: Artur Ciocanu <[email protected]>
Co-authored-by: Artur Ciocanu <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Use Java Bean for connection details and add more tests (dapr#1317)

* Use Java Bean for connection details and add more tests

Signed-off-by: Artur Ciocanu <[email protected]>

* Simplify mock setup

Signed-off-by: Artur Ciocanu <[email protected]>

* Adding even more tests for test coverage

Signed-off-by: Artur Ciocanu <[email protected]>

---------

Signed-off-by: Artur Ciocanu <[email protected]>
Co-authored-by: Artur Ciocanu <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Update CONTRIBUTING.md

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Bump codecov/codecov-action from 5.4.0 to 5.4.2 (dapr#1318)

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.0 to 5.4.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v5.4.0...v5.4.2)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cassie Coyle <[email protected]>
Co-authored-by: Dapr Bot <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix URL building logic (dapr#1320)

* Fix URL building logic

Signed-off-by: Artur Ciocanu <[email protected]>

* Add test for query params

Signed-off-by: Artur Ciocanu <[email protected]>

* Fix the assertion in the test

Signed-off-by: Artur Ciocanu <[email protected]>

* Adjust the tests

Signed-off-by: Artur Ciocanu <[email protected]>

* Remove uneeded changes from IT test

Signed-off-by: Artur Ciocanu <[email protected]>

* Revert some unintended changes

Signed-off-by: Artur Ciocanu <[email protected]>

* Simplify the testing a little bit

Signed-off-by: Artur Ciocanu <[email protected]>

* Adjust the test to use ServerRequest

Signed-off-by: Artur Ciocanu <[email protected]>

* Test removing things from method invoke controller

Signed-off-by: Artur Ciocanu <[email protected]>

* Add query param encoding test

Signed-off-by: Artur Ciocanu <[email protected]>

* Revert some unintended changes

Signed-off-by: Artur Ciocanu <[email protected]>

* Some tiny styles

Signed-off-by: Artur Ciocanu <[email protected]>

---------

Signed-off-by: Artur Ciocanu <[email protected]>
Co-authored-by: Artur Ciocanu <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Generate updated javadocs for 1.14.1

Signed-off-by: Dapr Bot <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Add Conversation AI to Java SDK (dapr#1235)

* Conversation first commit

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* Add unit tests

Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* change ai to conv

Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* Move to single module

Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* Remove module

Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* Add Integration tests

Signed-off-by: siri-varma <[email protected]>

* Update sdk-tests/src/test/java/io/dapr/it/testcontainers/DaprConversationIT.java

Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: siri-varma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>

* Address comments

Signed-off-by: siri-varma <[email protected]>

* Import tag

Signed-off-by: siri-varma <[email protected]>

* Address comments

Signed-off-by: siri-varma <[email protected]>

* Make common config

Signed-off-by: siri-varma <[email protected]>

* Address comments

Signed-off-by: siri-varma <[email protected]>

* fix constant

Signed-off-by: siri-varma <[email protected]>

* fix constant

Signed-off-by: siri-varma <[email protected]>

* fix constant

Signed-off-by: siri-varma <[email protected]>

* fix s

Signed-off-by: siri-varma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>

* Make common config

Signed-off-by: siri-varma <[email protected]>

* Update README.md

Signed-off-by: Siri Varma Vegiraju <[email protected]>

* Update README.md

Signed-off-by: Siri Varma Vegiraju <[email protected]>

---------

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: sirivarma <[email protected]>
Signed-off-by: siri-varma <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Add docs for usage of Jobs SDK (dapr#1323)

* Add doc for jobs

Signed-off-by: siri-varma <[email protected]>

* Add docs for Jobs

Signed-off-by: siri-varma <[email protected]>

* Apply suggestions from code review

Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>

---------

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Co-authored-by: artur-ciocanu <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Use dapr/durabletask-java (dapr#1336)

* microsoft durabletask-java -> dapr durabletask-java

Signed-off-by: Cassandra Coyle <[email protected]>

* update another ref

Signed-off-by: Cassandra Coyle <[email protected]>

* 1.5.2 release

Signed-off-by: Cassandra Coyle <[email protected]>

* fix import order

Signed-off-by: Cassandra Coyle <[email protected]>

* Sdk new changes

Signed-off-by: siri-varma <[email protected]>

* Refine workflows

Signed-off-by: siri-varma <[email protected]>

* add ;

Signed-off-by: Cassandra Coyle <[email protected]>

* rm try

Signed-off-by: Cassandra Coyle <[email protected]>

---------

Signed-off-by: Cassandra Coyle <[email protected]>
Signed-off-by: siri-varma <[email protected]>
Co-authored-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Update master version to 1.16.0-SNAPSHOT

Signed-off-by: Dapr Bot <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix NPE

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Renaming and exposing connection details (dapr#1341)

Signed-off-by: Artur Ciocanu <[email protected]>
Co-authored-by: Artur Ciocanu <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* [Master] Fix Vulnerabilities (dapr#1354)

* update okio

Signed-off-by: Cassandra Coyle <[email protected]>

* rm unused dep

Signed-off-by: Cassandra Coyle <[email protected]>

---------

Signed-off-by: Cassandra Coyle <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Feat Add TLS & mTLS support for gRPC with root CA and insecure mode (dapr#1361)

* feat: Support for GRPC ssl

Signed-off-by: Javier Aliaga <[email protected]>

* add tests

Signed-off-by: Cassandra Coyle <[email protected]>

* fix CI

Signed-off-by: Cassandra Coyle <[email protected]>

* add back else if

Signed-off-by: Cassandra Coyle <[email protected]>

* channel cleanup

Signed-off-by: Cassandra Coyle <[email protected]>

* add root ca support

Signed-off-by: Cassandra Coyle <[email protected]>

* checkstyles

Signed-off-by: Cassandra Coyle <[email protected]>

* add insecure

Signed-off-by: Cassandra Coyle <[email protected]>

* fix checkstyles

Signed-off-by: Cassandra Coyle <[email protected]>

* use InsecureTrustManagerFactory

Signed-off-by: Cassandra Coyle <[email protected]>

* fix test

Signed-off-by: Cassandra Coyle <[email protected]>

---------

Signed-off-by: Javier Aliaga <[email protected]>
Signed-off-by: Cassandra Coyle <[email protected]>
Co-authored-by: Javier Aliaga <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Address comments

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

* Fix things

Signed-off-by: siri-varma <[email protected]>
Signed-off-by: sirivarma <[email protected]>

---------

Signed-off-by: sirivarma <[email protected]>
Signed-off-by: Artur Ciocanu <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Dapr Bot <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: siri-varma <[email protected]>
Signed-off-by: Cassandra Coyle <[email protected]>
Signed-off-by: Javier Aliaga <[email protected]>
Co-authored-by: Matheus Cruz <[email protected]>
Co-authored-by: artur-ciocanu <[email protected]>
Co-authored-by: Artur Ciocanu <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dapr Bot <[email protected]>
Co-authored-by: Dapr Bot <[email protected]>
Co-authored-by: Cassie Coyle <[email protected]>
Co-authored-by: Javier Aliaga <[email protected]>
Signed-off-by: salaboy <[email protected]>
Signed-off-by: Cassandra Coyle <[email protected]>
Signed-off-by: salaboy <[email protected]>
Signed-off-by: salaboy <[email protected]>
@salaboy salaboy force-pushed the adding-wf-examples-to-sb branch from 8374edf to aa7e980 Compare May 17, 2025 10:01
@salaboy
Copy link
Collaborator Author

salaboy commented May 17, 2025

@dapr/maintainers-java-sdk all comments addressed, please re review

Copy link

codecov bot commented May 17, 2025

Codecov Report

Attention: Patch coverage is 95.18717% with 9 lines in your changes missing coverage. Please review.

Project coverage is 78.12%. Comparing base (d759c53) to head (d806fd5).
Report is 145 commits behind head on master.

Files with missing lines Patch % Lines
...boot/examples/wfp/WorkflowPatternsApplication.java 33.33% 2 Missing ⚠️
...ot/examples/wfp/continueasnew/CleanUpActivity.java 83.33% 2 Missing ⚠️
...ot/examples/wfp/externalevent/ApproveActivity.java 77.77% 2 Missing ⚠️
...gboot/examples/wfp/externalevent/DenyActivity.java 77.77% 2 Missing ⚠️
...mples/wfp/continueasnew/ContinueAsNewWorkflow.java 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1377      +/-   ##
============================================
+ Coverage     76.91%   78.12%   +1.21%     
- Complexity     1592     1827     +235     
============================================
  Files           145      221      +76     
  Lines          4843     5633     +790     
  Branches        562      600      +38     
============================================
+ Hits           3725     4401     +676     
- Misses          821      913      +92     
- Partials        297      319      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpringBoot Workflow Examples
3 participants