Reload Drools configuration without restart OpenNMS

Description

It is currently not possible to reload the rules without restart OpenNMS. Part of the solution is persisting the state which is described on .

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Alejandro Galue August 2, 2017 at 3:40 PM

It seems like the developer team wants to see JUnit tests to verify that the reload operation works in order to merge the PR, so I'll try to work on that once I have time, even knowing that the solution was extensively tested.

Alejandro Galue July 25, 2017 at 5:41 PM

https://github.com/OpenNMS/opennms/pull/1609

Bamboo is still working, but all the tests are passing now.

Alejandro Galue July 20, 2017 at 10:26 PM

I found a problem with one use case:

If you send an event to update a running engine, and that fails (due to, for example, an error on the rules), the engine becomes unusable.

I'm going to fix this, so when it fails, the engine will be removed from the running environment, and when the engine is fixed, it can be added as a "new" engine (if it doesn't fail of course).

Alejandro Galue July 20, 2017 at 10:08 PM

I was able to refactor a bit the loading process in order to support the addition and removal of engines without restart.

Here is how it is going to work:

1) If you add a new engine directory to /opt/opennms/etc/drools-engines.d/ or remove an engine directory from the same location, you should send a reloadDaemonConfig event using DroolsCorrelationEngine as the value for the daemonName parameter.

2) If you modified an existing engine (like updating the context XML, the list of events, the DRL files, or the global variables), you should send a reloadDaemonConfig event using DroolsCorrelationEngine-XXX as the value for the daemonName parameter, where XXX is the name of the engine (i.e. the name attribute of the RuleSet defined inside the drools-engine.xml. That way, you won't affect the other running engines while doing this kind of expensive operation (as this will include saving/restoring the state if that option is enabled on the configuration.

I have a branch with all the above changes:

https://github.com/OpenNMS/opennms/tree/jira/NMS-9290

 

Will Keaney July 20, 2017 at 2:42 PM

Great!

Of course, renaming an existing one will cause the removal of the engine with the old name[...]

That's what I was expecting to happen in that case, anyway.

The vast majority of our restarts are for adding new or changed rules to existing engines, so the "hot-add new engine" question was more curiosity than requirement.

Thank you!
 

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

PagerDuty

Created April 17, 2017 at 12:47 PM
Updated August 9, 2017 at 5:39 PM
Resolved August 8, 2017 at 4:13 PM