Retry configuration for Activity from external source

I have a spring application where i have the logic for creating workflows and running them to external temporal server.

I wanted to set retry configurations like maxRetry for an Activity dynamically, i.e, from my application database. I tried to use my custom class inside workflow implementation file and set the values. But it was null.

Can someone help me on how to achieve this. Thanks

You can use the not yet released feature of setting ActivityOptions when initializing a worker:

WorkflowImplementationOptions options = WorkflowImplementationOptions.newBuilder().
                  .setDefaultActivityOptions(defaultOps)
                  .setActivityOptions(perActivityOptions)
                  .build();
worker.registerWorkflowImplementationType(implementationOptions, <WorkflowClass>.class);

Until the feature is released you can use ‘1.0.7-SNAPSHOT’ version of the temporal SDK. It also requires adding the snapshot repository to your build configuration file.