Use generic and the serializer interface to return the actual object for workflow activity
- Dominant language
- Java
- Stars
- 300
- Forks
- 230
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 4
Description
This issue is to follow the discussion in PR https://github.com/dapr/java-sdk/pull/880
====================
artursouza:
Use generic and the serializer interface to return the actual object. See how it is done for DaprClient
skyao:
this run() method defined in WorkflowActivity doesn't have a input parameter, we need to call ctx.getInput() to get the input, like this:
public Object run(WorkflowActivityContext ctx) {
OrderPayload order = ctx.getInput(OrderPayload.class);
logger.info("Requesting approval for order: {}", order);
return ApprovalResult.Approved;
}
I suggest to move this input parameter from ctx to run() method:
public interface WorkflowActivity{
Output run(WorkflowActivityContext ctx, Input input);
}
artursouza: Exactly. Also, use TypeRef from the main SDK. See how we do it for Actors and state store.
Contributor guide
Assessment
This issue has not been assessed yet.