runNodeBlocking
Runs node with the default RunNodeConfig and returns its output, or null if it produces none.
Pass null for nodeInput when the child takes no input. Otherwise this behaves like the three-argument runNodeBlocking overload, which lists all requirements and exceptions.
Throws
if nodeInput is a RunNodeConfig; pass options to the three-argument overload instead
Runs node as a child of the current Java FunctionNode body and blocks until it finishes. Returns the child's output, or null if it produces none.
Rules and behavior:
Setup: Build the calling node with
rerunOnResume(true).Threading: This call blocks the calling thread, not the workflow. If you pass a custom dispatcher to
FunctionNodes, make sure it has a free thread for the child's body too.Running children in parallel: Prefer calling runNode for each child from the body's thread and waiting for the returned futures before the body returns. This avoids extra waiting threads and numbers run IDs in call order.
Concurrent calls: If multiple threads call
runNodeBlockingat the same time, set an explicit run ID in config for each call. Otherwise, auto-numbered IDs depend on thread timing.Child pauses for user input: If node pauses for input, this method throws an internal Throwable rather than an
Exception. Acatch (Exception e)block lets it through so the calling node pauses cleanly. Acatch (Throwable t)block catches it: the node still waits for the child, but first emits your fallback as its output.Waiting on futures: If you wait on a runNode future, or run
runNodeBlockinginside another future, letExecutionExceptionandCompletionExceptionpropagate. The runtime unwraps them so the calling node pauses cleanly. CatchingExceptionaroundget()orjoin()catches that wrapper: the node still waits for the child, but first emits your fallback as its output.
Parameters
run options matching runNode, such as an explicit run ID
Throws
if node fails; its error property holds the child's failure
if called outside a running Java body, or for any reason listed on Context.runNode
for any reason listed on Context.runNode
named WorkflowInvariantException if, on resume, node waits over 15 seconds for nodes or children recorded ahead of it
if the calling node is cancelled or the waiting thread is interrupted. Interrupting the thread cancels this call's run of node, waits for it to stop, and leaves the thread's interrupt flag set. If the thread was already interrupted before the call, a node that finishes before the call blocks still returns its result.