temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
200 stars 134 forks source link

Fail workflow task on illegal calls in `Workflow.await` #2044

Open Quinn-With-Two-Ns opened 2 months ago

Quinn-With-Two-Ns commented 2 months ago

Is your feature request related to a problem? Please describe.

Workflow.await is expected to be idempotent, so it is not allowed to make any calls to mutate workflow state like start an activity. If we detect any such call we should fail the workflow task since it indicates a bug in the workflow implementation.

boolean activityExecuted = Workflow.await(Duration.ofSeconds(5), () -> {
    activity.doSomething();
    return true;
});