[rules-users] Rules don't execute using MVEL syntax in RHS - Possible Bug

Wolfgang Laun wolfgang.laun at gmail.com
Fri May 9 12:42:16 EDT 2014


You are using a class called KnowledgeBuilder. With Drools 6,
it is KieBuilder. Here is some simple code, good for testing (as I used it),
although more sophisticated build procedures are recommended
using maven and what not. - Both DRL versions (getAbxDef and abcDef) appear to
work with 6.0.0 Final.

	KieServices kieServices = KieServices.Factory.get();
	KieFileSystem kfs = kieServices.newKieFileSystem();
        FileInputStream fis = new FileInputStream( "lostrule/lostrule.drl" );
        kfs.write( "src/main/resources/lostrule.drl",
                    kieServices.getResources().newInputStreamResource( fis ) );
        KieBuilder kieBuilder = kieServices.newKieBuilder( kfs ).buildAll();
        Results results = kieBuilder.getResults();
        if( results.hasMessages( Message.Level.ERROR ) ){
	    System.out.println( results.getMessages() );
            throw new IllegalStateException( "### errors ###" );
	}

        KieContainer kieContainer =
	    kieServices.newKieContainer(
kieServices.getRepository().getDefaultReleaseId() );

	KieBaseConfiguration config = kieServices.newKieBaseConfiguration();
	config.setOption(EventProcessingOption.STREAM);
        KieBase kieBase = kieContainer.newKieBase( config );
        kieSession = kieContainer.newKieSession();


On 09/05/2014, jlprat <jlprat at gmail.com> wrote:
> Hi,
> I added the AnEvent class in the gist. You can check it out now:
> https://gist.github.com/jlprat/f20e6dbe976cff163d2c
>
> Best,
> Josep
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029496.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list