--- layout: docs title: Rules engine header: Rules engine prev_section: user-guide/defining-rules next_section: user-guide/managing-rules doc: true --- Easy Rules engine holds a registry of rules with unique names. Each instance of Easy Rules engine can be seen as a separate namespace. Rules are applied according to their natural order (which is priority by default). ## Create a rules engine To create a rules engine and register a rule, you can use the static method `RulesEngineBuilder.aNewEngineBuilder()`: ```java RulesEngine rulesEngine = aNewEngineBuilder().build(); rulesEngine.registerRule(myRule); ``` You can then fire registered rules as follows: ```java rulesEngine.fireRules(); ``` ## Rules engine parameters Easy Rules engine can be configured with the following parameters:
Parameter Type Required Default
rulePriorityThreshold int no Integer.MAX_VALUE
skipOnFirstAppliedRule boolean no false
skipOnFirstFailedRule boolean no false
silentMode boolean no false
The `skipOnFirstAppliedRule` parameter tells the engine to skip next rules when a rule is applied. The `skipOnFirstFailedRule` parameter tells the engine to skip next rules when a rule fails. The `rulePriorityThreshold` parameter tells the engine to skip next rules if priority exceeds the defined threshold. Silent mode allows you to mute all loggers when needed. You can specify these parameters through the `RulesEngineBuilder` API: ```java RulesEngine rulesEngine = aNewRulesEngine() .withRulePriorityThreshold(10) .withSkipOnFirstAppliedRule(true) .withSkipOnFirstFailedRule(true) .withSilentMode(true) .build(); ```