java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

feat: Support registering activities with custom name

Open javier-aliaga opened this issue 6 months ago • 2 comments

Description

This PR allow to register activities with a custom name. This is useful in case you want to reuse activities or want to give more meaningful name to the activity.

    builder.registerActivity(FirstActivity.class);
    builder.registerActivity("a",FirstActivity.class);
    builder.registerActivity("b",FirstActivity.class);

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: #[issue number]

Checklist

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

  • [ ] Code compiles correctly
  • [x] Created/updated tests
  • [ ] Extended the documentation

javier-aliaga avatar Jun 20 '25 15:06 javier-aliaga

Javi, without the intention of slowing things down, I find it odd to do this at registration time, as the same activity can be used in different workflows with different names, so I would just do this at runtime, instead of registration. I might not have the full context if you have discussed this with the team.

Registering the same activity with multiple names also looks odd to me

  • Blog: http://salaboy.com http://salaboy.wordpress.com

  • Github user: http://github.com/salaboy

  • Twitter: http://twitter.com/salaboy

  • Mauricio "Salaboy" Salatino -

On Sat, 21 Jun 2025 at 01:23, codecov[bot] @.***> wrote:

codecov[bot] left a comment (dapr/java-sdk#1431) https://github.com/dapr/java-sdk/pull/1431#issuecomment-2992189286 Codecov https://app.codecov.io/gh/dapr/java-sdk/pull/1431?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.48%. Comparing base (d759c53) https://app.codecov.io/gh/dapr/java-sdk/commit/d759c53f8c110fac13056e3d484a3e5f233e0dad?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr to head (2028f95) https://app.codecov.io/gh/dapr/java-sdk/commit/2028f9538e7cf98108a505ad2aaad7340ef1775c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr . Report is 172 commits behind head on master.

Files with missing lines https://app.codecov.io/gh/dapr/java-sdk/pull/1431?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr Patch % Lines ...orkflows/runtime/WorkflowActivityClassWrapper.java https://app.codecov.io/gh/dapr/java-sdk/pull/1431?src=pr&el=tree&filepath=sdk-workflows%2Fsrc%2Fmain%2Fjava%2Fio%2Fdapr%2Fworkflows%2Fruntime%2FWorkflowActivityClassWrapper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-c2RrLXdvcmtmbG93cy9zcmMvbWFpbi9qYXZhL2lvL2RhcHIvd29ya2Zsb3dzL3J1bnRpbWUvV29ya2Zsb3dBY3Rpdml0eUNsYXNzV3JhcHBlci5qYXZh 66.66% 2 Missing ⚠️ https://app.codecov.io/gh/dapr/java-sdk/pull/1431?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr Additional details and impacted files

@@ Coverage Diff @@## master #1431 +/- ## ============================================+ Coverage 76.91% 78.48% +1.56% - Complexity 1592 1871 +279

Files 145 230 +85 Lines 4843 5795 +952 Branches 562 601 +39 ============================================+ Hits 3725 4548 +823 - Misses 821 927 +106 - Partials 297 320 +23

☔ View full report in Codecov by Sentry https://app.codecov.io/gh/dapr/java-sdk/pull/1431?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr . 📢 Have feedback on the report? Share it here https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr . 🚀 New features to boost your workflow:

— Reply to this email directly, view it on GitHub https://github.com/dapr/java-sdk/pull/1431#issuecomment-2992189286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCMXX3K2FLOLKFSPVNM2L3EQYQTAVCNFSM6AAAAAB7YREQTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJSGE4DSMRYGY . You are receiving this because your review was requested.Message ID: @.***>

salaboy avatar Jun 21 '25 01:06 salaboy

Mmmmmm, @salaboy , let me see I think I can go a bit further and do it

javier-aliaga avatar Jun 30 '25 07:06 javier-aliaga

ey @salaboy I am recovering this PR as it introduces new benefits to the sdk. Not only you can name classes it also allows using anonymous classes to register activities.

javier-aliaga avatar Jul 31 '25 12:07 javier-aliaga

ey @dapr/maintainers-java-sdk and @dapr/approvers-java-sdk , what do you think about this one? I find it useful to be able to declare activities with an anonymous class. It also allow registering activities with name

javier-aliaga avatar Aug 04 '25 07:08 javier-aliaga

Codecov Report

:x: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 78.72%. Comparing base (d759c53) to head (88be309). :warning: Report is 202 commits behind head on master.

Files with missing lines Patch % Lines
...orkflows/runtime/WorkflowActivityClassWrapper.java 66.66% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1431      +/-   ##
============================================
+ Coverage     76.91%   78.72%   +1.80%     
- Complexity     1592     1922     +330     
============================================
  Files           145      237      +92     
  Lines          4843     5931    +1088     
  Branches        562      610      +48     
============================================
+ Hits           3725     4669     +944     
- Misses          821      939     +118     
- Partials        297      323      +26     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Aug 26 '25 15:08 codecov[bot]