Skip to content

Non-blocking Activity task implementations #2

@cgillum

Description

@cgillum

Issue

The TaskActivity interface is currently has a synchronous run method that returns that output of that activity:

public interface TaskActivity {
    Object run(TaskActivityContext ctx);
}

There's currently no way to define a non-blocking, asynchronous activity implementation. This can result in issues related to the scalability of applications if many activity tasks need to be executed concurrently.

Proposal

There should be an alternative mechanism for implementing non-blocking, asynchronous activity tasks. For example:

public interface AsyncTaskActivity {
    CompletionStage<Object> run(TaskActivityContext ctx);
}

The activity will finish when the CompletionStage is completed.

Other considerations

It should be noted that Azure Functions for Java doesn't yet support non-blocking functions: Azure/azure-functions-java-worker#244. Support for non-blocking activity tasks likely won't benefit Azure Functions users until the Java worker for Azure Functions adds async function support. Unfortunately, there's no indication about if or when this support will be added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Priority 3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions