Add more details to WorkflowTaskRetryHandler
Describe the proposal
Add task name and task input to WorkflowTaskRetryContext to allow for additional error-handling capabilities in the RetryHandler.
/assign
@TheForbiddenAi thank you for the issue and pr. Could you pleae clarify what "additional error-handling capabilities" mean ?
@siri-varma Yea so let's say you want to control the retry handlers flow based off of a field in the input object for the activity. As of now you can only access the input values of workflow and not the activities or child workflows.
Additionally, if you want to wanted to be able to have one central retry handler but still want to have some small amount of activity specific logic. There is no way to know what activity is currently executing. The workaround for this now would be to create a whole new retry handler and chain it to the original retry handler. But that will lead to duplicate code if you have code in the original retry handler that has to be executed before the activity specific handler.
Thank you for the explanation. If my understanding is right, you want to change the retry handler based on input to the activity.
Within a workflow, when activities are triggered, the input to the activity is something we send isn't it ? So, my assumption is we already have access to the input or am I missing something
Yes, that is right. However, we don't have access to the activity/child workflows input because we pass the parent workflow context not the activity context. We do have access to the parent workflow input via the context.
If you don't mind, can you add an example of your use case in the PR ? That will make things more clear.
May be here https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows
@siri-varma I added an example. Another thing to note is that having access to the input at retry handle time would allow the input to be extracted and sent elsewhere (i.e. an incident report). I still need to update the readme and will do that in a little bit
readme has been updated