Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generic and the serializer interface to return the actual object for workflow activity #905

Open
skyao opened this issue Sep 13, 2023 · 1 comment
Labels
Milestone

Comments

@skyao
Copy link
Member

skyao commented Sep 13, 2023

This issue is to follow the discussion in PR #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<Input, Output>{
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.

@cgillum
Copy link

cgillum commented Oct 15, 2024

This is a breaking change, so if it needs to be done, it needs to be done in v1.15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Status: Backlog
Development

No branches or pull requests

4 participants