temporalio / temporalio/sdk-java

Provide ActivityStub that is bound to the specific activityType or a specific invocation

Open
#1,009 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Temporal JavaSDK has an untyped WorkflowStub that is bound to a specific method invocation (workflow method), while a currently existing ActivityStub is bound to the AcitivityInterface and not to the specific activity type.

The source of the inconsistency is that one WorkflowInterface has always only one "entry" workflow method, while an ActivityInterface can have several ActivityMethod.

To keep things consistent, we should have a variation of the ActivityStub that binds an execution of the activity to a specific type the same way as WorkflowStub. There also should be an ActivityStub.fromTyped method working similarly with WorkflowStub.fromTyped (but probably taking a method reference instead of a pointer to an instance)

The current Activity stub that we have in JavaSDK looks like

public interface ActivityStub {
  <R> R execute(String activityName, Class<R> resultClass, Object... args);

  <R> R execute(String activityName, Class<R> resultClass, Type resultType, Object... args);

  <R> Promise<R> executeAsync(String activityName, Class<R> resultClass, Object... args);

  <R> Promise<R> executeAsync(
      String activityName, Class<R> resultClass, Type resultType, Object... args);
}```
which is inconsistent with WorkflowStub and makes it harder to work with untyped ActivityStubs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing ActivityStub and WorkflowStub APIs described in the issue. Define the specific activity-type or invocation binding and the ActivityStub.fromTyped behavior, then verify that the resulting API supports both typed and untyped activity execution consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.