Skip to main content

parent_command

Macro parent_command 

Source
macro_rules! parent_command {
    ($target:expr) => { ... };
}
Expand description

Parent command macro for subgraph-to-parent routing

Allows a node inside a subgraph to request routing to a specific node in the parent graph. This works as an exception mechanism: the macro returns a JunctureError::parent_command(target) which the SubgraphNode wrapper catches and converts to Command::goto(target).

§Syntax

parent_command!("target_node_name")

§Examples

use juncture_core::parent_command;

async fn my_subgraph_node(state: SubState) -> Result<SubStateUpdate, JunctureError> {
    if should_exit() {
        // Route directly to "publish" node in the parent graph
        parent_command!("publish");
    }
    Ok(SubStateUpdate::default())
}