Class ReactiveScriptEngine
java.lang.Object
com.soulfiremc.server.script.ReactiveScriptEngine
Reactive execution engine for visual scripts. Uses Project Reactor for proper fan-in synchronization and parallel branch execution.
Key features:
- Fan-in: Waits for all upstream DATA edges before executing a node
- Parallelism: Independent branches execute concurrently via Flux.flatMap
- Dynamic routing: Follows exec output ports whose IDs appear in node outputs
- Self-driving loops: Loop nodes call back into the engine via NodeRuntime.executeDownstream
- Error routing: Nodes with exec_error ports route errors; others stop the branch
- Muted bypass: Muted nodes pass execution context through unchanged
- Per-invocation isolation: Each trigger creates its own ExecutionRun
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> execute(ScriptGraph graph, InstanceManager instance, ScriptEventListener eventListener) Executes the full graph (for testing/one-shot execution).reactor.core.publisher.Mono<Void> executeFromTrigger(ScriptGraph graph, String triggerNodeId, ReactiveScriptContext context, Map<String, NodeValue> eventInputs) Executes a script starting from a specific trigger node.Gets a registered node by type.Returns all registered node types.
-
Constructor Details
-
ReactiveScriptEngine
public ReactiveScriptEngine()
-
-
Method Details
-
executeFromTrigger
public reactor.core.publisher.Mono<Void> executeFromTrigger(ScriptGraph graph, String triggerNodeId, ReactiveScriptContext context, Map<String, NodeValue> eventInputs) Executes a script starting from a specific trigger node. Used by ScriptTriggerService when an event fires.- Parameters:
graph- the script graphtriggerNodeId- the trigger node to start fromcontext- the reactive execution contexteventInputs- inputs from the triggering event- Returns:
- a Mono that completes when execution finishes
-
execute
public reactor.core.publisher.Mono<Void> execute(ScriptGraph graph, InstanceManager instance, ScriptEventListener eventListener) Executes the full graph (for testing/one-shot execution).- Parameters:
graph- the script graph to executeinstance- the SoulFire instanceeventListener- listener for execution events- Returns:
- a Mono that completes when the script finishes
-
getNode
Gets a registered node by type.- Parameters:
type- the node type identifier- Returns:
- the node implementation, or null if not found
-
getRegisteredNodeTypes
-