Are there any guidelines or a precaution around using a @SignalMethod and an @UpdateMethod for the same workflow?

Both the @SignalMethod and the @UpdateMethod update the state of the workflow, the @SignalMethod was conveniently used with the signalWithStart() method allowing me to start a workflow if it’s not started already, and signal it if it’s already running.

I have seen a few instances where the @UpdateMethod can race with the @SignalMethod and cause disruptions in the event histories, affecting the replays of events when the workflow state gets reconstructed on long running workflows.

Temporal SDK: 1.25.0

Code Snippet:

@WorkflowInterface
public interface DemoWorkflow {
    @WorkflowMethod
    void startWorkflow(WorkflowInput input);

    @UpdateMethod
    Response get(String Id);

    @SignalMethod
    void aggregate(Payload payload);
}

// client code:
final BatchRequest batchRequest = workflowClient.newSignalWithStartRequest();
           
batchRequest.add(notificationWorkflow::startWorkflow, new WorkflowInput());
batchRequest.add(workflow::aggregate, payload);

final WorkflowExecution workflowExecution = workflowClient.signalWithStart(batchRequest);

@maxim any ideas? ^

If you believe that there is a bug in the SDK, please submit a reproduction or at least specific scenarios with more details. It is very hard to troubleshoot a problem based on “I have seen a few instances” without any specifics.