context.waitForEvent
to pause a workflow until a specific event occurs and resume it with event data when the event is received.
context.waitForEvent
waitForEvent
method pauses the execution of a workflow and waits for an external event to occur, identified by an event ID. This is particularly useful in asynchronous workflows that rely on external systems to provide data or signals.
timeout
variable will be true
.
Maximum timeout value is equal to the “Max Delay” value of your QStash plan. It’s 7 days for free users, 1 year for pay as you go users and unlimited for pro users.
client.notify
notify
method is used to notify a workflow that the expected event has occurred. It notifies all workflows waiting for the given eventId
and provides the eventData
to the waiting workflows, allowing them to resume execution.
eventData
provided in client.notify
will be available in the result of context.waitForEvent
as it is.
context.notify
context.notify
method.