<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p.de1, li.de1, div.de1
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:716204861;
        mso-list-template-ids:-1951213496;}
@list l1
        {mso-list-id:2124571303;
        mso-list-template-ids:-706082456;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>To accomplish this is largely a &#8220;renaming&#8221;
operation.&nbsp; They are syntactically the same.&nbsp; I did a similar thing a few
months ago and it mostly involved renaming everything from RuleXXX to
KnowledgeXXX.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Chetan Mahadev<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, October 26, 2009
4:10 PM<br>
<b><span style='font-weight:bold'>To:</span></b> rules-users@lists.jboss.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [rules-users] Is there
any way to hook-up Drools 4.0 RuleBase(session) to a Drools 5.0 KnowledgeBase
(session) ??</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi ,<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>We have been using drools 4.0 in our application. All the rules are
loaded using RuleBase and PackageBuilder.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>The application is pretty old, and has got lot of work into it.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Now we want to use Drools 5.0 CEP (Fusion) along with the old rules
(based on drools 4.0).<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>But the problem , is, how can we hook-up the old &quot;RuleBase&quot;
based sessions with the &quot;KnowledgeBase&quot; sessions of Drools 5.0??<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>The use case is:<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>1.Fact enters the system ( asserted using Rulebase), is enriched by
rules (Based on Drools 4.0)<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2.The same fact will be treated as EVENT (for CEP), for
further&nbsp;correlation of Events (facts)&nbsp; using KnowledgeBase as
proposed i Drools 5.0.<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>I am facing difficulty in hooking up the two sessions. Is there an
way??<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Following is the test i did. ( <a
href="http://drools.pastebin.com/m7d6c613b">http://drools.pastebin.com/m7d6c613b</a>)<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Can anybody help??<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>IN MY JAVA CODE<o:p></o:p></span></font></p>

</div>

<div>

<div>

<div>

<div>

<ol start=1 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>//load up the rulebase<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=2 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; RuleBase ruleBase = readRule(); //&nbsp;Read and load
     rules frm a packagebuilder()<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=3 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; StatefulSession rBaseSession =
     ruleBase.newStatefulSession();<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=4 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; Message message = new Message();<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=5 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; message.setMessage( &nbsp;&quot;Hello World&quot; );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=6 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; message.setStatus( Message.HELLO );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=7 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; rBaseSession.insert( message );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=8 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=9 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @@//Load KnoweledgeBase &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=10 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     KnowledgeBase kbase = loadRuleBase();&nbsp; // I set options for
     EventProcessing in loadRuleBase()<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=11 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     KnowledgeSessionConfiguration conf = <o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=12 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     KnowledgeBaseFactory.newKnowledgeSessionConfiguration();<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=13 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     ((SessionConfiguration) conf).setClockType( ClockType.REALTIME_CLOCK );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=14 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     StatefulKnowledgeSession&nbsp; &nbsp; &nbsp; &nbsp; kbaseSession =
     &nbsp;kbase.newStatefulKnowledgeSession(conf,null);<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=15 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; <o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=16 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     rBaseSession.fireAllRules(); &nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=17 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l0 level1 lfo1'><font size=3 face="Courier New"><span
     style='font-size:12.0pt;font-family:"Courier New"'>&nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

</div>

<p class=de1><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=de1><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>IN MY RULE FILE</span></font><o:p></o:p></p>

<div>

<ol start=1 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>rule &quot;Hello World&quot;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=2 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; when<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=3 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; $m : Message( status == Message.HELLO, message : message )<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=4 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; then<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=5 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; System.out.println( message ); <o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=6 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; Message message2 = new Message();<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=7 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     message2.setMessage( &nbsp;&quot;Hello World&quot; );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=8 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     message2.setStatus( Message.HELLO );<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=9 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=10 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp;
     WorkingMemoryEntryPoint eventsignaturestream =
     drools.getEntryPoint(&quot;EVENT SIGNATURE STREAM&quot;) ;&nbsp; // I Get
     a NULLPOINTER EXCEPTION here<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=11 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     eventsignaturestream.insert(message2);<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=12 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></li>
</ol>

</div>

<div>

<ol start=13 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l1 level1 lfo2'><font size=3 face="Times New Roman"><span
     style='font-size:12.0pt'>end<o:p></o:p></span></font></li>
</ol>

</div>

</div>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

</div>

</body>

</html>