Reputation: 31
I am new to Drools and am trying to use KieScanner to do hot swap of my rules. I have read the documentation and the discussions around this subject. I am not clear on a few things. The following code snippet is straight from Drools 6.4 documentation:
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId( "org.acme", "myartifact", "1.0-SNAPSHOT" );
KieContainer kContainer = kieServices.newKieContainer( releaseId );
KieScanner kScanner = kieServices.newKieScanner( kContainer );
Thank you so much for your help in advance.
Upvotes: 0
Views: 4201
Reputation: 2398
For this, you can reference the documentation chapter 4.2.3.5 "Settings.xml and Remote Repository Setup":
The settings.xml file can be located in 3 locations, the actual settings used is a merge of those 3 locations.
- The Maven install: $M2_HOME/conf/settings.xml
- A user's install: ${user.home}/.m2/settings.xml
- Folder location specified by the system property kie.maven.settings.custom
The settings.xml is used to specify the location of remote repositories.
Personally, I find very helpful to specify to the KieScanner a custom Maven settings file via the system property kie.maven.settings.custom
, because normally I have my KJAR artifacts and Jar of the "model" only in a custom internal repository (and not on public repo or Maven central).
I think meaningful here to highlight what is my personal common pitfall with hot-swap rules... Be aware drools incremental compilation works at resources level, so if a rule should not re-trigger after the hot-swap, either make sure you have guarding condition on the LHS that will naturally ensure that will be guaranteed, or either you should keep those unmodified rules isolated in their own resources(/files).
Hope this helps
Upvotes: 2