How to invoke rules in KieSession utilizing the CEP feature within Camel?

Solution Verified - Updated -


  • The requirement is that while running the CEP (Complex Event Processing) within Camel route, rules need to be invoked every time when KieSession is being used to insert events/facts (e.g. events of type com.mycompany.camel.spring.StatefulBeanFact which is inserted in KieSession every time the route is executed). Referring to brms-fuse-osgi-examples to set up a development environment for integration, it appears that rules are invoked only when the session is stateless. While KieSession is used the rules are fired just once. How to invoke rules in stateful ksession or KieSession utilizing the CEP feature within Camel?


    <route id="StatefulRules">
        <from uri="timer:foo?period=30s"/>
        <log message="Logging message to Stateful  Rules"/>
        <to uri="kie:ksession-stateful?action=insertBody"/>


<bean id="statefulFact" class="com.mycompany.camel.spring.StatefulBeanFact" >
        <property name="firstName" value="Musharraf"/>
        <property name="secondName" value="Hussain"/>
        <property name="stateful" value="true" />        
    <bean id="kiePostProcessor" class="org.drools.osgi.spring.OsgiKModuleBeanFactoryPostProcessor" />
    <kie:kmodule id="camel-context">
        <kie:kbase name="drl">
            <kie:ksession name="ksession-stateful" type="stateful">


    package com.redhat.sample..drools;

    rule "TestRule"
        eval( true )
        System.out.println("Simple Rules are getting invoked");


  • Red Hat JBoss Fuse (Fuse)
    • 6.2.0
  • Red Hat JBoss BRMS (BRMS)
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content