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

Java SDK does not have option to register workflow name statically

Open ftkurt opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when trying to register a Java workflow with a static name. The current option using annotations does not work for our use case. We define proto enums and share them across different apps so they can trigger workflows across apps. For instance, we have:

public interface MyWorkflow {
    @WorkflowMethod(name = "MyStaticWorkflowName")
    void execute();
}

We need a way to set a default workflow implementation type name during registration.

Describe the solution you'd like A method to register a workflow with a static name during registration using something like:

WorkflowImplementationOptions options = WorkflowImplementationOptions.newBuilder()
        .setDefaultWorkflowImplementationTypeName(Workflows.WORKFLOWS_SEND_SUBMISSION.name())
        .build();

worker.registerWorkflowImplementationTypes(options, SendSubmissionWorkflowImpl.class);

This would allow us to define workflows that can be triggered across different apps with a shared static name.

Describe alternatives you've considered Currently, the alternative is to use the short name of the workflow interface by default. However, this does not meet our needs as we cannot share interfaces across apps written in different languages (Golang, Python). Using annotations alone is insufficient for our scenario.

Additional context Our apps in Golang and Python cannot share Java interfaces, hence the need for a static name registration method. We currently share these names through protobuf-defined enums which can be built for all apps and envs.

ftkurt avatar Jun 24 '24 11:06 ftkurt

Would you also need the same functionality for activity names?

Quinn-With-Two-Ns avatar Jun 25 '24 18:06 Quinn-With-Two-Ns

@Quinn-With-Two-Ns yes, that will be useful as well. We are running some activities cross platform as well.

ftkurt avatar Jun 27 '24 11:06 ftkurt