read drl files from filesystem

2,263 views
Skip to first unread message

Drools User

unread,
Mar 11, 2015, 6:31:13 AM3/11/15
to drools...@googlegroups.com
Hello,
I am able to execute rules when they are placed in classpath . Is it possible to read rules(*.drl files) from filesystem?
Is it possible to mention the file path in kmodule.xml?

Abhijit Humbe

unread,
Mar 11, 2015, 7:48:25 AM3/11/15
to drools...@googlegroups.com
We can load file rule from filesystem using 'KieFileSystem', like as:

===============
KieFileSystem kfs = kieServices.newKieFileSystem();
File file = new File("path/to/Sample.drl");
Resource resource = kieServices.getResources().newFileSystemResource(file).setResourceType(ResourceType.DRL);
 kfs.write( resource); 
KieBuilder kb = kieServices.newKieBuilder(kfs);
 kb.buildAll();
===============
Give a try with this approach.


--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/40230767-8d8f-4e20-82c4-d45934ad5a9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Drools User

unread,
Mar 11, 2015, 8:51:10 AM3/11/15
to drools...@googlegroups.com
Thank you

Mark Proctor

unread,
Mar 11, 2015, 10:36:34 AM3/11/15
to drools...@googlegroups.com
lot of examples here, that show different ways to load rules. Each example is in the documentation too.

Mark
Reply all
Reply to author
Forward
0 new messages