<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:right;
        direction:rtl;
        unicode-bidi:embed;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">Hello,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">I've got the following basic code that sets up drools in STREAM mode, with a pseudo clock.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">And it fails on the last line that asserts there is an entrypoint named &quot;testEntryPoint&quot;.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">The DRL file references the entry-point which according to the documentation is enough.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">What am I missing?<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">Itai<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">declare Message<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">@role(event)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">@timestamp(timestamp)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">end<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">declare AppInfo<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">@role(event)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">@timestamp(timestamp)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">end<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">rule &quot;Change message type after one minute&quot;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; dialect &quot;mvel&quot;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">when<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; $appinfo:AppInfo() from entry-point &quot;testEntryPoint&quot;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; $message:Message( type == &quot;before&quot;, $msgtext : msgtext, this after[ 1m ] $appinfo )<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from entry-point &quot;testEntryPoint&quot;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">then<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; System.out.println( $msgtext );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; modify ( $message ) {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type = &quot;after&quot;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; }<span lang="HE" dir="RTL"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">end<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; private void initDrools() {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Stream mode allows interacting with the clock (Drools Fusion)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; config.setOption(EventProcessingOption.STREAM);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kbase = KnowledgeBaseFactory.newKnowledgeBase(config);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this will parse and compile in one step<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kbuilder.add(ResourceFactory.newClassPathResource(RULE_FILE, DroolsExpertTest.class), ResourceType.DRL);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Check the builder for errors<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assertThat(kbuilder.hasErrors())<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .overridingErrorMessage(kbuilder.getErrors().toString())<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .isFalse();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // get the compiled packages (which are
 serializable)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Collection&lt;KnowledgePackage&gt; pkgs = kbuilder.getKnowledgePackages();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add the packages to a knowledgebase
 (deploy the knowledge packages).<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kbase.addKnowledgePackages(pkgs);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span lang="HE" dir="RTL" style="font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span dir="LTR"></span><span dir="LTR"></span><span style="font-family:&quot;Courier New&quot;"><span dir="LTR"></span><span dir="LTR"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; conf.setOption(ClockTypeOption.get(&quot;pseudo&quot;));<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ksession = kbase.newStatefulKnowledgeSession(conf,null);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clock = ksession.getSessionClock();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; entryPoint = ksession.getWorkingMemoryEntryPoint(&quot;testEntryPoint&quot;);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assertThat(entryPoint).isNotNull();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed"><span style="font-family:&quot;Courier New&quot;">}<o:p></o:p></span></p>
</div>
</body>
</html>