Execute Rule Chain
# Asynchronous Execution of Rule Chain
Does not block the parent process. You can listen for the end through types.WithOnEnd
or types.WithOnAllNodeCompleted
. The usage is as follows:
ruleEngine, ok := rulego.Get("rule-01")
ruleEngine.OnMsg(msg, opts ...types.RuleContextOption)
1
2
2
# Synchronous Execution of Rule Chain
Blocks the parent process, and will not proceed until all nodes of the rule chain have completed execution. The usage is as follows:
ruleEngine, ok := rulego.Get("rule-01")
ruleEngine.OnMsgAndWait(msg, opts ...types.RuleContextOption)
1
2
2
This meets the use case where it is necessary to return to the parent process. If this scenario is not required, use the asynchronous call method.
# RuleContextOption
Reference: options
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/30, 13:29:22