You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.4 KiB
1.4 KiB
layout | title | header | prev_section | next_section | doc |
---|---|---|---|---|---|
docs | Managing rules | Managing rules at runtime | user-guide/rules-engine | tutorials/hello-world | true |
Being able to dynamically reconfigure business rules at runtime in production systems is a recurrent requirement.
Thanks to JMX, Easy Rules can expose rules attributes to be managed via any JMX compliant client.
First, you need to add the following dependency to your pom.xml:
<dependencies>
<dependency>
<groupId>org.easyrules</groupId>
<artifactId>easyrules-jmx</artifactId>
<version>{{site.version}}</version>
</dependency>
</dependencies>
To make your rule manageable via JMX, it should:
- implement the
JmxRule
interface or extend theBasicJmxRule
class - or be annotated with
javax.management.MXBean
if it is a annotated POJO
Once you defined your rule as a Jmx Compliant object, you can register it in a JmxRulesEngine
as a managed rule:
JmxRulesEngine rulesEngine = aNewJmxRulesEngine.build();
rulesEngine.registerJmxRule(myJmxCompliantRule);
This will register your rule as a JMX managed bean with the following object name:
org.easyrules.core.jmx:type=YourRuleClassName,name=YourRuleName
An example of using dynamic rule reconfiguration at runtime is provided in the online shop tutorial.