Pausing workflow execution until Signal returns

Hello!

I am trying to write a workflow in Python that waits for an asynchronous response to be signalled to the workflow. This response can take a few minutes, depending on when the third party service calls our webhook.

Is the proper way to do this to do workflow.wait_condition(lambda: self._my_signal) in the workflow?

Will the worker be blocked the whole time waiting for the signal? And would the workflow immediately resume when it gets the signal?

1 Like

Hi, i dont familiar with python sdk but in java it looks like that:

class WorkflowExample {

    private WebhookResponse wenhookResponse;
    
    public workflowMethod() {
          // call activity 1
          activity1()

          // worker would not waste server resource while waiting, process will just stop and when it recieves signal it will calculate state from all the past events and execute upcoming activities
          Workflow.await(() -> wenhookResponse != null)

          // activity 2
          activity1()
    }

    public signalMethod(WebhookResponse wenhookResponse) {
        this.webhookResponse = wenhookResponse;
    }
}
1 Like