Skip to content

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

Open
@skyao

Description

@skyao

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions