[rules-users] How to deploy Fusion ?

eskomk esko.hujanen at ebsolut.fi
Fri Aug 26 11:08:03 EDT 2011


Hi all,

I'm new to Drools.
We need to have Fusion features in our systems, especially temporal
relations on events.
The problem is we don't know how to take Fusion in use.

Our rules do not fire, why ?
What are the steps to get Fusion up and running ?

We are using Drools as a web service, and it is fed with xml-formed facts
through REST interface.
Drools itself works ok.
We use Guvnor as rule editor, and have its snapshot included as CHANGE_SET
resource in knowledge-services.xml, so that's not a problem.

The rules we are now interested in sits in separate .drl files which are
read as DRL resources in knowledge-services.xml
(file contents below, with BBBafterAAA.drl as a resource).

As I have understood, we must change to stateful session from stateless, to
use Fusion.
This is so that we can define the event processing mode as STREAM in
kbase-definition,
and clock-type as REALTIME in session-definition.

We are primarily using Drools version 5.1.1 on several physical and virtual
servers
(we are just learning Drools for now, primaliry gathering data to be used in
Drools).
Now I am testing Drools version 5.3.0-SNAPSHOT (drools-camel-server),
where the config file snippet below are taken.

<path> below replaces the actual package names.

We have declared some incoming facts to be events (never mind the Bean
ending):
declares_drl.drl
{file}
package org.test;

import <path>.AAABean;
import <path>.BBBBean;


declare AAABean
    @role(event)
end

declare BBBBean
    @role(event)
end
{/file}

File BBBafterAAA.drl contents, withot THEN part:
{file}
package org.test;

import <path>.AAABean;
import <path>.BBBBean;

/*
declare AAABean
    @role(event)
end

declare BBBBean
    @role(event)
end
*/

rule "BBBAfterAAA"
dialect "mvel"
no-loop true
salience 100

when
    $Aaa : AAABean();
    $Bbb : BBBBean(this after[10s, 10m] $Aaa);
then
// Consequences go here
{/file}

File knowledge-services.xml contents:
{file}
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:drools="http://drools.org/schema/drools-spring"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring-1.3.0.xsd">

  <drools:grid-node id="node1"/>
  
  <drools:resource-change-scanner id="scanner" interval="2" />
  
  &lt;bean name=&quot;CCCInitBean&quot; class=&quot;&lt;path&gt;.InitBean">
	<property name="initOk" value="false"/>
  </bean>	


  <drools:kbase id="kbase1" node="node1">
    <drools:resources>
            <drools:resource  type="DRL" source="classpath:test.drl"/>
            <drools:resource  type="DRL"
source="classpath:declares_drl.drl"/>
            <drools:resource  type="DRL"
source="classpath:BBBafterAAA.drl"/>
            <drools:resource  type="CHANGE_SET"
source="classpath:ChangeSet.xml"/>
    </drools:resources>
    
    <drools:configuration>
            <drools:event-processing-mode mode="STREAM"/>
    </drools:configuration>						
  </drools:kbase>
  
	
  <drools:kagent id="kagent1" kbase="kbase1" new-instance="false">
	<drools:resources>
        
		<drools:resource  type="CHANGE_SET" source="classpath:ChangeSet.xml"/>
        
	</drools:resources>
  </drools:kagent>
		
  
  <drools:ksession id="ksession1" type="stateful" kbase="kbase1"
node="node1">	
        <drools:configuration>
            <drools:clock-type type="REALTIME"/>
        </drools:configuration>
		<drools:batch>
			<drools:insert-object ref="mirellaInitBean"/>
			<drools:fire-all-rules /> 
		</drools:batch>
        

  </drools:ksession>	


</beans>
{/file}


Cheers,
Esko
http://www.ebsolut.fi

--
View this message in context: http://drools.46999.n3.nabble.com/How-to-deploy-Fusion-tp3287119p3287119.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list