<?xml version="1.0"?><rss version="2.0">
<channel>
  <title>Java Beans dot Asia - drools category</title>
  <link>http://javabeans.asia/categories/drools/</link>
  <description>Just a few simple tutorials</description>
  <language>en</language>
  <copyright>Alexander Zagniotov</copyright>
  <lastBuildDate>Tue, 23 Feb 2010 11:04:00 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  <image>
    <url>/images/blog-image.jpg</url>
    <title>Java Beans dot Asia (drools category)</title>
    <link>http://javabeans.asia/</link>
  </image>
  <item>
    <title>Enriching Rich Internet Applications with rule-based reasoning</title>
    <link>http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html</link>
	 <description>
        I came across a Firefox &lt;a target=&#034;_blank&#034; title=&#034;Firefox add-on web rules - Drools-like condition language&#034; href=&#034;https://addons.mozilla.org/en-US/firefox/addon/8098&#034;&gt;Add-On&lt;/a&gt; today by Matthias Tylkowski, that lets user to modify the browser view of his/her  preferred web pages. For example, user can modify the appearance of &lt;a target=&#034;_blank&#034; title=&#034;CNN News&#034; href=&#034;http://www.cnn.com&#034;&gt;cnn.com&lt;/a&gt; to suit his/her needs.&lt;br /&gt;
&lt;br /&gt;
The add-on or the web rules is a JSON-based rule language, where each rule is a JSON object. In addition, Javascript is used for method calls. The web rules use Drools-like condition language:
&lt;pre name=&#034;code&#034; class=&#034;java:firstline[1]&#034;&gt;{&amp;quot;id&amp;quot;:&amp;quot;rule101&amp;quot;,&lt;br /&gt;  &amp;quot;appliesTo&amp;quot;: [&lt;br /&gt;       &amp;quot;http://www.cnn.com&amp;quot;&lt;br /&gt;     ],&lt;br /&gt; &amp;quot;condition&amp;quot;:&lt;br /&gt;  &amp;quot;$X:Element( class == &#039;note&#039;,&lt;br /&gt;               $Y:firstChild&lt;br /&gt;             )&lt;br /&gt;             &amp;amp;&amp;amp;&lt;br /&gt;             ($Y.nodeName == &#039;ul&#039;)&amp;quot;,&lt;br /&gt; &amp;quot;actions&amp;quot;:[&lt;br /&gt;  &amp;quot;changeBackground($Y, &#039;blue&#039;)&amp;quot;&lt;br /&gt;   ]&lt;br /&gt; }&lt;/pre&gt;
For all elements of class &lt;strong&gt;&lt;em&gt;note&lt;/em&gt;&lt;/strong&gt; having as first child an &lt;strong&gt;&lt;em&gt;ul&lt;/em&gt;&lt;/strong&gt;, change the first child background color to blue.&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;br /&gt;
I think its a quite cool add-on.&lt;br /&gt;
&lt;br /&gt;
Resources:&lt;br /&gt;
&lt;em&gt;&lt;a href=&#034;http://bpt.hpi.uni-potsdam.de/pub/Public/EmilianPascalau/JSONRulesSlides.pdf&#034; target=&#034;_blank&#034;&gt;JSON Rules&lt;/a&gt;&lt;/em&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;t=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;t=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;i&gt;There are no related posts for this blog entry&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          I came across a Firefox Add-On today by Matthias Tylkowski, that lets user to modify the browser view of his/her  preferred web pages. For example, user can modify the appearance of cnn.com to suit his/her needs.  The add-on or the web rules is a JSON-based rule language, where each rule is a JSON object. In ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;t=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;title=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html&amp;amp;t=Enriching Rich Internet Applications with rule-based reasoning&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>json</category>
    <category>drools</category>
    <category>javascript</category>
    <comments>http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2010/02/23/enriching_rich_internet_applications_with_rule_based_reasoning.html</guid>
    <pubDate>Mon, 22 Feb 2010 14:00:00 GMT</pubDate>
  </item>
  <item>
    <title>Rule Engine Stress Testing</title>
    <link>http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html</link>
	 <description>
        I came across a &lt;a target=&#034;_blank&#034; title=&#034;Illation Blog&#034; href=&#034;http://blogs.illation.com.au/&#034;&gt;blog&lt;/a&gt; by a company called &lt;a target=&#034;_blank&#034; title=&#034;Illation&#034; href=&#034;http://illation.com.au&#034;&gt;Illation&lt;/a&gt;. What those guys do is compare performance of several rule engines available on the market: Drools, ILog, OPSJ and Jess.&lt;br /&gt;
&lt;br /&gt;
The stress tests cover different aspects, for example:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Rules firing time&lt;/li&gt;
    &lt;li&gt;Data load time&lt;/li&gt;
    &lt;li&gt;Memory usage&lt;/li&gt;
    &lt;li&gt;Pre-run memory used&lt;/li&gt;
    &lt;li&gt;Post-run memory used&lt;/li&gt;
&lt;/ul&gt;
The test results available  on their blog for the wide public. The team also makes business rules, object model and datasets used in their stress tests available for download if someone wishes to repeat the tests. Some of the results look very interesting.&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;t=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;t=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - working with Stateless session&#034;&gt;Drools - working with Stateless session&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          I came across a blog by a company called Illation. What those guys do is compare performance of several rule engines available on the market: Drools, ILog, OPSJ and Jess.  The stress tests cover different aspects, for example:      Rules firing time     Data load time     Memory usage     Pre-run memory used     ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;t=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;title=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&amp;amp;t=Rule Engine Stress Testing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>java</category>
    <category>drools</category>
    <comments>http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html</guid>
    <pubDate>Sat, 05 Sep 2009 01:15:00 GMT</pubDate>
  </item>
  <item>
    <title>Drools 5 Case Study 2 - Complex Event Processing</title>
    <link>http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html</link>
	 <description>
        In my previous post &lt;a title=&#034;Drools Fusion Complex Event Processing&#034; href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;, I gave introduction to Drools Fusion module. In the current post, I would like to demonstrate Drools Fusion capabilities.&lt;br /&gt;
&lt;br /&gt;
As an example chosen for the current article, I decided to use a scenario when an insurance firm rewards its policy members. The members are rewarded when they keep a low average of claimed money under the threshold set on their account over a period of time. &lt;br /&gt;
&lt;br /&gt;
In other words, if the policy member had last five claims average and average of claims during last ninety (90) days lower than the threshold limit - he/she will be eligible for a reward.&lt;br /&gt;
&lt;br /&gt;
Drools allows us to test for these conditions by applying&amp;nbsp; the sliding window concept. So to obtain a claim average for a&amp;nbsp; particular period in time, I will use time based sliding window. To obtain an average of last five claims, I will use length based sliding window.&lt;br /&gt;
&lt;br /&gt;
Before I begin, I would like to say that the source code for this article is available as attachment, the download link is at the bottom.&lt;br /&gt;
&lt;br /&gt;
Ok, lets begin. Below is my POJO &lt;em&gt;Account&lt;/em&gt;:
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;public class Account {&lt;br /&gt;  private String number = &amp;quot;&amp;quot;;&lt;br /&gt;  private double threshold = 0.00;&lt;br /&gt;&lt;br /&gt;  public Account() {&lt;br /&gt;    super();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getNumber() {&lt;br /&gt;    return number;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  public void setNumber(String number) {&lt;br /&gt;    this.number = number;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getThreshold() {&lt;br /&gt;    return threshold;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setThreshold(double threshold) {&lt;br /&gt;    this.threshold = threshold;&lt;br /&gt;  }	&lt;br /&gt;}&lt;/pre&gt;
The following is my implementation of the claim event POJO:
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;public class ClaimApprovedEvent implements Serializable {&lt;br /&gt;&lt;br /&gt;  private static final long serialVersionUID = 1L;&lt;br /&gt;&lt;br /&gt;  private String accountNumber = &amp;quot;&amp;quot;;&lt;br /&gt;  private double amount = 0.00;&lt;br /&gt;&lt;br /&gt;  public ClaimApprovedEvent(String accountNumber, &lt;br /&gt;                                   double amount) {&lt;br /&gt;    this.accountNumber = accountNumber;&lt;br /&gt;    this.amount = amount;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getAccountNumber() {&lt;br /&gt;    return accountNumber;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAccountNumber(String accountNumber) {&lt;br /&gt;    this.accountNumber = accountNumber;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getAmount() {&lt;br /&gt;    return amount;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAmount(double amount) {&lt;br /&gt;    this.amount = amount;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
This event represents a claim event when a policy member has claimed some money. Event contains policy member account number and the claim amount. These events, I will be &amp;quot;feeding&amp;quot; in to the &lt;em&gt;KnowledgeSession &lt;/em&gt;as facts. Yes, they are play a role knowledge facts in Drools. &lt;br /&gt;
&lt;br /&gt;
Having said that I want to point out that all events are facts, but not all facts are events. I know it maybe a little bit confusing, but if you read Drools 5.0 doco it will become more clearer to you. &lt;br /&gt;
&lt;br /&gt;
To give some information about it - events almost never change state in Drools (&lt;em&gt;almost &lt;/em&gt;means it is still possible to change the state of event), therefore they are immutable. &lt;br /&gt;
&lt;br /&gt;
Events simply hold information about something that has already happened and because you cannot change what has already happened - events are immutable. Events also allow the use of sliding windows. &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The following is implementation of a POJO, that plays a role of a common data structure for rules to use at run time. It is one of the new features that available in Drools 5. Keep in mind - that this is not a knowledge fact, but just a data structure. &lt;br /&gt;
&lt;br /&gt;
This POJO is an internal type, therefore there is no need to create new instance of this class. The object will only be created at run time, when the knowledge package is compiled (In my tester class I show how to do it). For now, we just have to add POJOs declaration to DRL, and to have the source file present. Later on, you will see how the declaration in DRL is done:
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;public class AccountInfo {&lt;br /&gt;&lt;br /&gt;  private String accountNumber = &amp;quot;&amp;quot;;&lt;br /&gt;  private double aveOfLastClaims = 0.00;&lt;br /&gt;  private double aveForPeriod = 0.00;&lt;br /&gt;  private boolean eligibleForBonusClaims = false;&lt;br /&gt;  private boolean eligibleForPeriodicBonus = false;&lt;br /&gt;&lt;br /&gt;  public AccountInfo() {&lt;br /&gt;    super();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getAccountNumber() {&lt;br /&gt;    return accountNumber;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAccountNumber(String accountNumber) {&lt;br /&gt;    this.accountNumber = accountNumber;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getAveOfLastClaims() {&lt;br /&gt;    return aveOfLastClaims;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAveOfLastClaims(&lt;br /&gt;                  double aveOfLastClaims) {&lt;br /&gt;    this.aveOfLastClaims = aveOfLastClaims;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public double getAveForPeriod() {&lt;br /&gt;    return aveForPeriod;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setAveForPeriod(double aveForPeriod) {&lt;br /&gt;    this.aveForPeriod = aveForPeriod;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public boolean isEligibleForBonusClaims() {&lt;br /&gt;    return eligibleForBonusClaims;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setEligibleForBonusClaims(&lt;br /&gt;             boolean eligibleForBonusClaims) {&lt;br /&gt;    this.eligibleForBonusClaims = eligibleForBonusClaims;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public boolean isEligibleForPeriodicBonus() {&lt;br /&gt;    return eligibleForPeriodicBonus;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void setEligibleForPeriodicBonus(&lt;br /&gt;                 boolean eligibleForPeriodicBonus) {&lt;br /&gt;    this.eligibleForPeriodicBonus = &lt;br /&gt;                             eligibleForPeriodicBonus;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
...and the following is the DRL:
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;package net.javabeansdotasia.casestudy.pojo;&lt;br /&gt;&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.ClaimApprovedEven&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.Account;&lt;br /&gt;&lt;br /&gt;declare ClaimApprovedEvent&lt;br /&gt;  // declare a fact type as an event, default is &#039;fact&#039;&lt;br /&gt;  @role( event )&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;// Decalare common data structure for all rules to use&lt;br /&gt;declare AccountInfo&lt;br /&gt;  accountNumber : String&lt;br /&gt;  aveOfLastClaims : Double&lt;br /&gt;  aveForPeriod : Double&lt;br /&gt;  eligibleForBonusClaims : Boolean&lt;br /&gt;  eligibleForPeriodicBonus : Boolean&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;rule &amp;quot;FiveLastClaims&amp;quot;&lt;br /&gt;  dialect &amp;quot;mvel&amp;quot;&lt;br /&gt;  no-loop true&lt;br /&gt;  salience 100&lt;br /&gt;&lt;br /&gt;when&lt;br /&gt;  $account : Account()&lt;br /&gt;&lt;br /&gt;  //check if the average of last five claims is less &lt;br /&gt;  //than the account threshold&lt;br /&gt;  $aveOfLastClaims : Number(&lt;br /&gt;           $account.threshold &amp;gt; doubleValue ) &lt;br /&gt;  from accumulate(&lt;br /&gt;    ClaimApprovedEvent(&lt;br /&gt;      accountNumber == $account.number, &lt;br /&gt;      $amount : amount&lt;br /&gt;    ) &lt;br /&gt;    over window:length( 5 ) from &lt;br /&gt;    entry-point ClaimStream, &lt;br /&gt;    average($amount)&lt;br /&gt;  )&lt;br /&gt;&lt;br /&gt;  //the member must not have received eligibility &lt;br /&gt;  //for last claim bonus yet &lt;br /&gt;  $accountInfo : AccountInfo( &lt;br /&gt;    accountNumber == $account.number, &lt;br /&gt;    eligibleForBonusClaims == false &lt;br /&gt;  )&lt;br /&gt;then&lt;br /&gt;  modify($accountInfo) {&lt;br /&gt;    setAveOfLastClaims($aveOfLastClaims);&lt;br /&gt;    setEligibleForBonusClaims(true);&lt;br /&gt;  };&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;rule &amp;quot;NinetyDaysPeriod&amp;quot;&lt;br /&gt;dialect &amp;quot;mvel&amp;quot;&lt;br /&gt;no-loop true&lt;br /&gt;salience 90&lt;br /&gt;&lt;br /&gt;when&lt;br /&gt;  $account : Account()&lt;br /&gt;&lt;br /&gt;  //check if the average of claims for period is less &lt;br /&gt;  //than the account threshold&lt;br /&gt;  $aveForPeriod : Number(&lt;br /&gt;                $account.threshold &amp;gt; doubleValue ) &lt;br /&gt;  from accumulate(&lt;br /&gt;    ClaimApprovedEvent(&lt;br /&gt;      accountNumber == $account.number, &lt;br /&gt;      $amount : amount&lt;br /&gt;    ) &lt;br /&gt;  over window:time( 90d ) from &lt;br /&gt;  entry-point ClaimStream, &lt;br /&gt;  average($amount)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;//the member must have eligibility for last claim bonus and&lt;br /&gt;//the member must not have received eligibility for &lt;br /&gt;//periodic bonus yet&lt;br /&gt;  $accountInfo : AccountInfo( &lt;br /&gt;    accountNumber == $account.number, &lt;br /&gt;    eligibleForBonusClaims == true, &lt;br /&gt;    eligibleForPeriodicBonus == false &lt;br /&gt;  )&lt;br /&gt;then&lt;br /&gt;  modify($accountInfo) {&lt;br /&gt;    setAveForPeriod($aveForPeriod);&lt;br /&gt;    setEligibleForPeriodicBonus(true);&lt;br /&gt;  };&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;rule &amp;quot;EligibleForVoucher&amp;quot;&lt;br /&gt;dialect &amp;quot;mvel&amp;quot;&lt;br /&gt;no-loop true&lt;br /&gt;salience 80&lt;br /&gt;&lt;br /&gt;when&lt;br /&gt;  $account : Account()&lt;br /&gt;&lt;br /&gt;//the member must have eligibility for last claim bonus and&lt;br /&gt;//the member must have eligibility for periodic bonus&lt;br /&gt;  $accountInfo : AccountInfo( &lt;br /&gt;    accountNumber == $account.number, &lt;br /&gt;    eligibleForBonusClaims == true, &lt;br /&gt;    eligibleForPeriodicBonus == true&lt;br /&gt;  )&lt;br /&gt;then&lt;br /&gt;  System.out.println(&amp;quot;Notifying policy member...&amp;quot;); &lt;br /&gt;  System.out.println(&amp;quot;Dear member, you have claimed &amp;quot;&lt;br /&gt;  + &amp;quot;in average $&amp;quot; +  $accountInfo.aveOfLastClaims + &lt;br /&gt;  &amp;quot; during last five claims, which is &amp;quot; + &lt;br /&gt;  &amp;quot;under the account threshold of $&amp;quot; + $account.threshold);&lt;br /&gt;&lt;br /&gt;  System.out.println(&amp;quot;Dear member, you have claimed &amp;quot; +&lt;br /&gt;  &amp;quot;in average $&amp;quot; + $accountInfo.aveForPeriod + &lt;br /&gt;  &amp;quot; during last 90 days, which is &amp;quot;+ &lt;br /&gt;  &amp;quot;under the account threshold of $&amp;quot; + $account.threshold);&lt;br /&gt;&lt;br /&gt;  System.out.println(&amp;quot;You are eligible for a holiday!&amp;quot;);&lt;br /&gt;end&lt;/pre&gt;
Lets have a look what does this DRL do:&lt;br /&gt;
&lt;ol&gt;
    &lt;li&gt;Modifying existing type by specifying that &lt;em&gt;ClaimApprovedEvent &lt;/em&gt;is an event (line 6). To allow Drools to process events, we have to set that the fact is of type event&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Declaring new type that plays the role of a common data structure (line 12). This is the declaration that I was talking about previously.&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;rule &amp;quot;&lt;em&gt;FiveLastClaims&lt;/em&gt;&amp;quot; obtains an average of last five event claims and compares it to the account threshold. If the rule return true, the &lt;em&gt;AccountInfo &lt;/em&gt;is updated with new data for other rules to use.&lt;/li&gt;
    &lt;li&gt;rule &amp;quot;&lt;em&gt;NinetyDaysPeriod&lt;/em&gt;&amp;quot; obtains an average claim totals over a period of ninety (90) days and compares it to the account threshold. If the rule return true, the &lt;em&gt;AccountInfo &lt;/em&gt;is updated with new data for other rules to use&lt;/li&gt;
    &lt;li&gt;rule &amp;quot;&lt;em&gt;EligibleForVoucher&lt;/em&gt;&amp;quot; checks if the account owner has both eligibility for a periodic bonus and last five claim bonus, if true - the policy member will be eligible for a reward&lt;/li&gt;
&lt;/ol&gt;
The following is the snippet code from my Tester class where I show how to I load claim events over a period of time into the Knowledge session entry point (once again to remind: please refer to the source code attached for more information):
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;SessionPseudoClock clock = session.getSessionClock();&lt;br /&gt;&lt;br /&gt;WorkingMemoryEntryPoint claimStream = session&lt;br /&gt;.getWorkingMemoryEntryPoint(&amp;quot;ClaimStream&amp;quot;);&lt;br /&gt;&lt;br /&gt;claimStream.insert(&lt;br /&gt;new ClaimApprovedEvent(account.getNumber(), 12.00));&lt;br /&gt;clock.advanceTime(80, TimeUnit.DAYS);&lt;br /&gt;&lt;br /&gt;claimStream.insert(&lt;br /&gt;new ClaimApprovedEvent(account.getNumber(), 46.00));&lt;br /&gt;clock.advanceTime(15, TimeUnit.DAYS);&lt;br /&gt;&lt;br /&gt;claimStream.insert(&lt;br /&gt;new ClaimApprovedEvent(account.getNumber(), 60.00));&lt;br /&gt;clock.advanceTime(45, TimeUnit.DAYS);&lt;br /&gt;&lt;br /&gt;claimStream.insert(&lt;br /&gt;new ClaimApprovedEvent(account.getNumber(), 110.00));&lt;br /&gt;clock.advanceTime(60, TimeUnit.DAYS);&lt;br /&gt;&lt;br /&gt;claimStream.insert(&lt;br /&gt;new ClaimApprovedEvent(account.getNumber(), 20.00));&lt;br /&gt;&lt;br /&gt;session.insert(account);&lt;br /&gt;session.insert(accountInfo);&lt;br /&gt;session.fireAllRules();&lt;br /&gt;&lt;/pre&gt;
Please note an entry point &amp;quot;&lt;em&gt;ClaimStream&lt;/em&gt;&amp;quot;. Entry point plays a role of a partition in &lt;em&gt;KnowledgeSession&lt;/em&gt; in Drools. Partitioning is also a new concept in Drools that makes KnowledgeSession multithreaded. You can have multiple entry points and choose where to insert the fact. &lt;br /&gt;
&lt;br /&gt;
In the current example, I use only one partition (or entry point). If I would to use more than one, than I would have to enable multi-partitioning with the following code:
&lt;pre class=&#034;codeSample&#034;&gt;KnowledgeBaseConfiguration config = &lt;br /&gt;KnowledgeBaseFactory.newKnowledgeBaseConfiguration();&lt;br /&gt;config.setOption(MultithreadEvaluationOption.YES);&lt;br /&gt;&lt;/pre&gt;
Have a read Drools Fusion manual, the team really gives a good cover of this concept.&lt;br /&gt;
&lt;br /&gt;
I use &lt;em&gt;SessionPseudoClock&lt;/em&gt; that allows me to&amp;nbsp; test the rules by feeding claim events into the &lt;em&gt;KnowledgeSession&lt;/em&gt; over a period of time. As you can see, after each event I move the clock forward, simulation submission of each claim event in different time.&lt;br /&gt;
&lt;br /&gt;
The following is the program output:
&lt;pre class=&#034;codeSample&#034;&gt;Notifying policy member...&lt;br /&gt;&lt;br /&gt;Dear member, you have claimed in average $49.6 &lt;br /&gt;during last five claims, which is under the &lt;br /&gt;account threshold of $70.0&lt;br /&gt;&lt;br /&gt;Dear member, you have claimed in average $65.0 &lt;br /&gt;during last 90 days, which is under the account &lt;br /&gt;threshold of $70.0&lt;br /&gt;&lt;br /&gt;You are eligible for a holiday!&lt;br /&gt;&lt;/pre&gt;
That&#039;s it. In this example I showed how it is possible to process complex events over a period of time by applying sliding window concept. &lt;br /&gt;
&lt;br /&gt;
Please note that the above example was tested by me and its working fine. I also included source files for the above example as Eclipse project. You can simply create a new Java project from this existing Ant build.xml file. &lt;br /&gt;
&lt;br /&gt;
Also, I wanted to point out that in my Eclipse project setup my Drools binaries located under &lt;em&gt;JAVA_HOME/lib/drools-5.0-bin/&lt;/em&gt; (have a look at the build.xml)&lt;br /&gt;
&lt;br /&gt;
I hope this was clear :)&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;br /&gt;
&lt;br /&gt;
Resources:&lt;br /&gt;
&lt;em&gt;&lt;a href=&#034;http://www.packtpub.com/drools-jboss-rules-5-0-developers-guide/book&#034; target=&#034;_blank&#034;&gt;Drools JBoss Rules 5.0 Developer&#039;s Guide July 2009&lt;/a&gt;&lt;/em&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;t=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;t=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - working with Stateless session&#034;&gt;Drools - working with Stateless session&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          In my previous post Drools 5 - Complex Event Processing, I gave introduction to Drools Fusion module. In the current post, I would like to demonstrate Drools Fusion capabilities.  As an example chosen for the current article, I decided to use a scenario when an insurance firm rewards its policy members. The members ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;t=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;title=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&amp;amp;t=Drools 5 Case Study 2 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <enclosure url="http://javabeans.asia/files/src/drools-case-study-2-CEP.zip" length="11962" type="application/zip;charset=ISO-8859-1" />
    <category>drools</category>
    <comments>http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html</guid>
    <pubDate>Mon, 31 Aug 2009 14:45:00 GMT</pubDate>
  </item>
  <item>
    <title>Drools 5 - Complex Event Processing</title>
    <link>http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html</link>
	 <description>
        From Drools version 4 to version 5, the framework has undergone quite a few improvements. These include support for three additional business modeling techniques. So today, Drools is not only a rule engine, but much more than that.&lt;br /&gt;
&lt;br /&gt;
One of these techniques is event processing. The module that added event processing capabilities to the framework is called &lt;em&gt;Drools Fusion&lt;/em&gt;. It supports Complex Event Processing (CEP) and Event Stream Processing (ESP).&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt; &amp;quot;...Complex Event Processing, or CEP, is primarily an event processing concept that deals with the task of processing multiple events with the goal of identifying the meaningful events within the event cloud. CEP employs techniques such as detection of complex patterns of many events, event correlation and abstraction, event hierarchies, and relationships between events such as causality, membership, and timing, and event-driven processes...&amp;quot; &lt;/blockquote&gt;   &lt;em&gt;&lt;a title=&#034;Complex Event Processing&#034; target=&#034;_blank&#034; href=&#034;http://en.wikipedia.org/wiki/Complex_Event_Processing&#034;&gt;http://en.wikipedia.org/wiki/Complex_Event_Processing&lt;/a&gt;&lt;/em&gt; &lt;br /&gt;
&lt;br /&gt;
Drools Fusion utilizes event processing architecture that adds loose coupling to its components. In other words, one party can publish events and other party can listen to those events while unaware of the publishing party. &lt;br /&gt;
&lt;br /&gt;
Event can represent a change in state, for example banking transaction or insurance claim that was processed. CEP deals with complex event processing. Complex event is a collection of simpler events. Please refer to the diagram below:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;img alt=&#034;Drools - complex event processing&#034; title=&#034;Drools - complex event processing&#034; src=&#034;http://javabeans.asia/images/posts/cep_concept.jpg&#034; /&gt;  &lt;br /&gt;
&lt;br /&gt;
In my next post &lt;a title=&#034;Creating rules to process complex events using sliding time and length windows&#034; href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;, I talk about CEP and how Drools applies its processing power to solve complex event problems.&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;t=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;t=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - working with Stateless session&#034;&gt;Drools - working with Stateless session&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          From Drools version 4 to version 5, the framework has undergone quite a few improvements. These include support for three additional business modeling techniques. So today, Drools is not only a rule engine, but much more than that.  One of these techniques is event processing. The module that added event processing ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;t=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;title=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&amp;amp;t=Drools 5 - Complex Event Processing&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>drools</category>
    <comments>http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html</guid>
    <pubDate>Mon, 31 Aug 2009 12:05:00 GMT</pubDate>
  </item>
  <item>
    <title>Drools 5 Case Study 1- Writing DSL for DRL rule</title>
    <link>http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html</link>
	 <description>
        One of the blog readers, who posted a comment in my previous post &lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt; asked to me to help him with creating DSL for the following rule, so I decided to use his example as a small case study:&lt;br /&gt;
&lt;br /&gt;
For readability, I added some comments to the original rule:
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;rule &#039;Rank accomodation name&#039;&lt;br /&gt;salience 90&lt;br /&gt;when&lt;br /&gt;     /*&lt;br /&gt;       Matches every AccomodationBase&lt;br /&gt;     */&lt;br /&gt;     $accBase: AccomodationBase()&lt;br /&gt;&lt;br /&gt;     /* &lt;br /&gt;       Uses inline eval to evaluate that there is &lt;br /&gt;       no AccomodationBase of type AccomodationRank&lt;br /&gt;       in the session. &lt;br /&gt;       &lt;br /&gt;       To remind: inline eval evaluated only once &lt;br /&gt;       and then it is cached by Drools.&lt;br /&gt;     */&lt;br /&gt;     not AccomodationBase(eval($accBase &lt;br /&gt;                       instanceof AccomodationRank))&lt;br /&gt;&lt;br /&gt;     /* &lt;br /&gt;       Matches every AccomodationRank that has the same &lt;br /&gt;       level and the description as the AccomodationBase&lt;br /&gt;     */&lt;br /&gt;     $accRank: AccomodationRank( &lt;br /&gt;            level == $accBase.level, &lt;br /&gt;	    description == $accBase.description)&lt;br /&gt;then&lt;br /&gt;     /*&lt;br /&gt;	Increments the score&lt;br /&gt;     */&lt;br /&gt;     $accRank.setScore($accRank.getScore()+1);&lt;br /&gt;end &lt;br /&gt;&lt;/pre&gt;
For my solution, I created two POJOs, tester class DSL and DSLR files. The following is my DSL:
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;[when]AccomodationBaseObj = $accBase: AccomodationBase()&lt;br /&gt;[when]There is Accomodation base object of type Accomodation rank = eval($accBase instanceof AccomodationRank)&lt;br /&gt;[when]AccomodationRankObj = $accRank: AccomodationRank(level == $accBase.level, description == $accBase.description)&lt;br /&gt;[then]IncrementScore = $accRank.setScore($accRank.score+1);&lt;br /&gt;[then]PrintScore = System.out.println(&amp;quot;Rank score: &amp;quot; + $accRank.score);&lt;br /&gt;[then]PrintLevel = System.out.println(&amp;quot;Base level: &amp;quot; + $accBase.level);&lt;/pre&gt;
and this is the DSLR file:
&lt;pre name=&#034;code&#034; class=&#034;java&#034;&gt;package net.javabeansdotasia.casestudy;&lt;br /&gt;&lt;br /&gt;expander accomodation.dsl&lt;br /&gt;&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.AccomodationBase;&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.AccomodationRank;&lt;br /&gt;&lt;br /&gt;rule &amp;quot;Rank&amp;quot;  &lt;br /&gt;dialect &amp;quot;mvel&amp;quot;&lt;br /&gt;when  &lt;br /&gt;   AccomodationBaseObj&lt;br /&gt;   not (There is Accomodation base object of type Accomodation rank)&lt;br /&gt;   AccomodationRankObj&lt;br /&gt;then&lt;br /&gt;   IncrementScore &lt;br /&gt;   PrintScore&lt;br /&gt;   PrintLevel&lt;br /&gt;end&lt;/pre&gt;
In the following class I load DSL and DSLR files in to the &lt;em&gt;KnowledgeBuilder &lt;/em&gt;and get a &lt;em&gt;KnowledgeBase&lt;/em&gt; object. Once I have the &lt;em&gt;KnowledgeBase &lt;/em&gt;object, I can get &lt;em&gt;StatefulKnowledgeSession &lt;/em&gt;or &lt;em&gt;StatelessKnowledgeSession&lt;/em&gt;, depends on what I want to do.&lt;br /&gt;
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;package net.javabeansdotasia.casestudy.utils;&lt;br /&gt;&lt;br /&gt;import org.drools.KnowledgeBase;&lt;br /&gt;import org.drools.KnowledgeBaseFactory;&lt;br /&gt;import org.drools.builder.KnowledgeBuilder;&lt;br /&gt;import org.drools.builder.KnowledgeBuilderError;&lt;br /&gt;import org.drools.builder.KnowledgeBuilderErrors;&lt;br /&gt;import org.drools.builder.KnowledgeBuilderFactory;&lt;br /&gt;import org.drools.builder.ResourceType;&lt;br /&gt;import org.drools.io.ResourceFactory;&lt;br /&gt;&lt;br /&gt;public class MyKnowledgeBaseFactory {&lt;br /&gt;  public static KnowledgeBase &lt;br /&gt;                createKnowledgeBaseFromDSL(String dslr,&lt;br /&gt;			String dsl) throws Exception {&lt;br /&gt;&lt;br /&gt;   KnowledgeBuilder builder = &lt;br /&gt;            KnowledgeBuilderFactory&lt;br /&gt;				.newKnowledgeBuilder();&lt;br /&gt;&lt;br /&gt;     //Attention!!!!&lt;br /&gt;     //Add DSL BEFORE DSLR&lt;br /&gt;     builder.add(&lt;br /&gt;              ResourceFactory.newClassPathResource(dsl),&lt;br /&gt;						ResourceType.DSL);&lt;br /&gt;&lt;br /&gt;     builder.add(&lt;br /&gt;              ResourceFactory.newClassPathResource(dslr),&lt;br /&gt;				ResourceType.DSLR);&lt;br /&gt;&lt;br /&gt;     KnowledgeBuilderErrors errors = builder.getErrors();&lt;br /&gt;&lt;br /&gt;      if (errors.size() &amp;gt; 0) {&lt;br /&gt;	for (KnowledgeBuilderError error : errors) {&lt;br /&gt;		System.err.println(error);&lt;br /&gt;	}&lt;br /&gt;	throw new IllegalArgumentException(&amp;quot;Could not parse knowledge.&amp;quot;);&lt;br /&gt;      }&lt;br /&gt;      KnowledgeBase knowledgeBase = &lt;br /&gt;                KnowledgeBaseFactory.newKnowledgeBase();&lt;br /&gt;      knowledgeBase.addKnowledgePackages(&lt;br /&gt;                    builder.getKnowledgePackages());&lt;br /&gt;      return knowledgeBase;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
Below is my Tester class:
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;package net.javabeansdotasia.casestudy.test;&lt;br /&gt;&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.AccomodationBase;&lt;br /&gt;import net.javabeansdotasia.casestudy.pojo.AccomodationRank;&lt;br /&gt;import net.javabeansdotasia.casestudy.utils.MyKnowledgeBaseFactory;&lt;br /&gt;&lt;br /&gt;import org.drools.KnowledgeBase;&lt;br /&gt;import org.drools.runtime.StatefulKnowledgeSession;&lt;br /&gt;&lt;br /&gt;public class Test {&lt;br /&gt;&lt;br /&gt;   public static final void main(String[] args) {&lt;br /&gt;     try {&lt;br /&gt;        KnowledgeBase kbase = &lt;br /&gt;               MyKnowledgeBaseFactory&lt;br /&gt;		   .createKnowledgeBaseFromDSL(&lt;br /&gt;                        &amp;quot;accomodation.dslr&amp;quot;,&lt;br /&gt;			 &amp;quot;accomodation.dsl&amp;quot;);&lt;br /&gt;	StatefulKnowledgeSession ksession = &lt;br /&gt;              kbase.newStatefulKnowledgeSession();&lt;br /&gt;	AccomodationBase accomBase = &lt;br /&gt;                  new AccomodationBase(9, &amp;quot;Just Demo&amp;quot;);&lt;br /&gt;	AccomodationRank accomRank = &lt;br /&gt;                  new AccomodationRank(9, &amp;quot;Just Demo&amp;quot;);&lt;br /&gt;	ksession.insert(accomBase);&lt;br /&gt;	ksession.insert(accomRank);&lt;br /&gt;	ksession.fireAllRules();&lt;br /&gt;      } catch (Throwable t) {&lt;br /&gt;	 t.printStackTrace();&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
As you may have noticed, in Drools 5 the process of loading the rule files (DSL and DSLR) and getting a working session is different to Drools 4. In Drools 5 there is a whole new set of APIs. Basically, main change is that Drools now is knowledge oriented, instead of rule oriented. It was a real step forward in order to support other forms of logic, such as workflow and event processing. You can read about it in Drools 5.0 docs.&lt;br /&gt;
&lt;br /&gt;
That it. Please note that the above example was tested by me and its working fine. I also included source files for the above example as Eclipse project. You can simply create a new Java project from this existing Ant build.xml file. &lt;br /&gt;
&lt;br /&gt;
Also, I wanted to point out that in my Eclipse project setup my Drools binaries located under &lt;em&gt;JAVA_HOME/lib/drools-5.0-bin/&lt;/em&gt; (have a look at the build.xml)&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;t=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;t=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - working with Stateless session&#034;&gt;Drools - working with Stateless session&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          One of the blog readers, who posted a comment in my previous post Drools - tutorial on writing DSL template asked to me to help him with creating DSL for the following rule, so I decided to use his example as a small case study:  For readability, I added some comments to the original rule: rule &#039;Rank accomodation ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;t=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;title=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&amp;amp;t=Drools 5 Case Study 1- Writing DSL for DRL rule&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <enclosure url="http://javabeans.asia/files/src/drools-casestudy-1.zip" length="9535" type="application/zip;charset=ISO-8859-1" />
    <category>drools</category>
    <comments>http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html</guid>
    <pubDate>Sat, 29 Aug 2009 07:20:00 GMT</pubDate>
  </item>
  <item>
    <title>Feedback by the Drools Team</title>
    <link>http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html</link>
	 <description>
        Today while checking my blog&#039;s referrers, to my pleasant surprise I discovered that few Drools articles I have published on this blog, were praised by Mark Proctor in Drools blog. &lt;br /&gt;
&lt;br /&gt;
Mark is one of the Drools creators and I think at the moment the project lead. The following is the post where my articles were mentioned: &lt;a href=&#034;http://blog.athico.com/2009/08/some-articles-form-java-beans-dot-asia.html&#034; target=&#034;_blank&#034;&gt;Some articles form Java Beans dot Asia&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
It was really nice to be noticed by the Drools guys and get positive feedback. It means I am actually doing something right ;)&lt;br /&gt;
&lt;br /&gt;
Soon more articles to come on Drools 5.0 from yours truly ...&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;t=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;t=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - working with Stateless session&#034;&gt;Drools - working with Stateless session&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          Today while checking my blog&#039;s referrers, to my pleasant surprise I discovered that few Drools articles I have published on this blog, were praised by Mark Proctor in Drools blog.   Mark is one of the Drools creators and I think at the moment the project lead. The following is the post where my articles were ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;t=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;title=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&amp;amp;t=Feedback by the Drools Team&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>drools</category>
    <comments>http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html</guid>
    <pubDate>Sun, 23 Aug 2009 07:49:00 GMT</pubDate>
  </item>
  <item>
    <title>Brainteaser Drools: Testing Objects</title>
    <link>http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html</link>
	 <description>
        This can be a hard one, since it requires from you to be familiar with Drools.&lt;br /&gt;
&lt;br /&gt;
Consider the condition side of the following rules:&lt;br /&gt;
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;rule &amp;quot;object comparison one&amp;quot;&lt;br /&gt;&amp;nbsp;no-loop&lt;br /&gt;&amp;nbsp; when&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $customer1 : Customer( )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $customer2 : Customer(this != $customer1)&lt;br /&gt;&amp;nbsp; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&amp;quot;Rule one - Objects are equal&amp;quot;);&lt;br /&gt;end &lt;/pre&gt;
&lt;pre class=&#034;java&#034; name=&#034;code&#034;&gt;rule &amp;quot;object comparison two&amp;quot;&lt;br /&gt;&amp;nbsp;no-loop&lt;br /&gt;&amp;nbsp; when&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $customer1 : Customer( )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $customer2 : Customer(eval(this != $customer1))&lt;br /&gt;&amp;nbsp; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&amp;quot;Rule two - Objects are equal&amp;quot;);&lt;br /&gt;end &lt;/pre&gt;
&lt;strong&gt;Question(s)&lt;/strong&gt;:&lt;br /&gt;
Which of the two rules does valid comparison of the two Customer instances? &lt;br /&gt;
Which of the two rules is invalid? Why?&lt;br /&gt;
&lt;br /&gt;
Looking forward for your answers dear readers&lt;br /&gt;
&lt;br /&gt;
Resources:&lt;br /&gt;
&lt;em&gt;&lt;a href=&#034;http://www.packtpub.com/drools-jboss-rules-5-0-developers-guide/book&#034; target=&#034;_blank&#034;&gt;Drools JBoss Rules 5.0 Developer&#039;s Guide July 2009&lt;/a&gt;&lt;/em&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;t=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;t=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/04/05/brainteaser_broken_case_of_inheritance.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser: Broken case of inheritance&#034;&gt;Brainteaser: Broken case of inheritance&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/04/18/brainteaser_overridable_methods.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser: Overridable methods &#034;&gt;Brainteaser: Overridable methods &lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/01/brainteaser_arraylist_vs_treeset.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser: ArrayList VS TreeSet&#034;&gt;Brainteaser: ArrayList VS TreeSet&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          This can be a hard one, since it requires from you to be familiar with Drools.  Consider the condition side of the following rules: rule &amp;quot;object comparison one&amp;quot;no-loop when $customer1 : Customer( ) $customer2 : Customer(this != $customer1) then System.out.println(&amp;...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;t=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;title=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&amp;amp;t=Brainteaser Drools: Testing Objects&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>brainteaser</category>
    <category>drools</category>
    <comments>http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html</guid>
    <pubDate>Sat, 22 Aug 2009 12:50:00 GMT</pubDate>
  </item>
  <item>
    <title>Drools - tutorial on writing DSL template</title>
    <link>http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html</link>
	 <description>
        Few months ago I wrote a &lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034;&gt;post&lt;/a&gt; that describes an example that uses source DRL in conjunction with DSL template. In the current post, I want to describe and show with few examples how to write DSL template - whats allowed and whats not.&lt;br /&gt;
&lt;br /&gt;
Now, having said that, I want to say that I am not planning to repeat the whole &lt;a target=&#034;_blank&#034; href=&#034;http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/4.2.2/html-single/JBoss_Rules_Manual/#id3069180&#034;&gt;JBoss Rules manual&lt;/a&gt; - the Drools team done a great job. I just want&amp;nbsp; to share from my personal experience, what I have come across while working with Drools when writing DSLs. &lt;br /&gt;
&lt;br /&gt;
There are few upcoming changes coming in the future release of Drools (version 5) in terms of DSL. For example DSL will become more powerful in terms of regular expressions - it will be possible to include regexp in the DSL tokens. &lt;a href=&#034;http://tirelli.blogspot.com/&#034; target=&#034;_blank&#034;&gt;Edson Tirelli&lt;/a&gt; posted an &lt;a target=&#034;_blank&#034; href=&#034;http://blog.athico.com/search/label/DSL%20regexp%20antlr&#034;&gt;article written by Matt Geis&lt;/a&gt; on Drools Blog, that talks about it and gives few examples.&lt;br /&gt;
&lt;br /&gt;
Since I am working with Drools 4.0.7 these days, I will describe in the current post how to write DSLs for Drools 4.0.7. &lt;br /&gt;
&lt;br /&gt;
Within a scope of Drools, DSL&#039;s job to&amp;nbsp; map (expand) DRL expressions written in natural language into underlying programming code.&lt;br /&gt;
&lt;br /&gt;
When writing DSL there several basic DO&#039;s and DONT&#039;s you should be aware of:&lt;br /&gt;
&lt;ol&gt;
    &lt;li&gt;Don&amp;rsquo;t put closing semi-column at the end of DSL expression line:
    &lt;pre class=&#034;codeSample&#034;&gt;[when]Message status is {1} = m : Message(status == {1})&lt;span class=&#034;error&#034;&gt;;&lt;/span&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;&amp;nbsp;Avoid different token names on the left hand side (before the &amp;ldquo;=&amp;rdquo;) and right hand side (after the &amp;ldquo;=&amp;rdquo;) of the DSL expansion:
    &lt;pre class=&#034;codeSample&#034;&gt;[when]Message status is {&lt;span class=&#034;error&#034;&gt;3&lt;/span&gt;} = m:Message(status == {&lt;span class=&#034;error&#034;&gt;1&lt;/span&gt;})&lt;br /&gt;[then]Log &amp;quot;{&lt;span class=&#034;error&#034;&gt;message&lt;/span&gt;}&amp;quot; = System.out.println(&amp;quot;{&lt;span class=&#034;error&#034;&gt;bobo&lt;/span&gt;}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;&amp;nbsp;DSL expansion should be on one line. You can even have several expressions on the same line, but you cannot break the line. By putting expression on a new line will cause an exception during parsing:
    &lt;pre class=&#034;codeSample&#034;&gt;[when]Message id is {id} = m:Message(id == {id})&lt;br /&gt;[then]LogUpdate &amp;quot;{2}&amp;quot; = System.out.println(&amp;quot;{2}&amp;quot;);&lt;br /&gt;&lt;span class=&#034;error&#034;&gt;update(m);&lt;/span&gt;&lt;br /&gt;[when]Message status is {s} = m:Message(status == {s})&lt;br /&gt;[then]Log &amp;quot;{2}&amp;quot; = &lt;br /&gt;&lt;span class=&#034;error&#034;&gt;System.out.println(&amp;quot;{2}&amp;quot;);&lt;/span&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;Avoid having DSLs with the same name. It can create a confusion. Remember that DSL is parsed from top to bottom, so when two DSLs with the same name exist, the top one will apply during expansion since it will be matched first:
    &lt;pre class=&#034;codeSample&#034;&gt;[then]&lt;span class=&#034;error&#034;&gt;SetStatus&lt;/span&gt; {s} = System.out.println({s});&lt;br /&gt;[then]&lt;span class=&#034;error&#034;&gt;SetStatus&lt;/span&gt; {s} = m.setStatus({s});&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;If token has quotes on the left hand side of the DSL, then the token must have quotes on the right hand side of the DSL:
    &lt;pre class=&#034;codeSample&#034;&gt;[then]SetMessage &lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;{msg}&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt; = m.setStatus(&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;{msg}&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;&amp;nbsp;There is no room for typos:
    &lt;pre class=&#034;codeSample&#034;&gt;rule &amp;quot;set-hello&amp;quot;&lt;br /&gt;   when&lt;br /&gt;	True&lt;br /&gt;   then&lt;br /&gt;	SetMessa&lt;span class=&#034;error&#034;&gt;ge&lt;/span&gt; &amp;quot;Hello&amp;quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;
    &lt;pre class=&#034;codeSample&#034;&gt;[then]SetMessa&lt;span class=&#034;error&#034;&gt;g&lt;/span&gt; &amp;quot;{msg}&amp;quot; = m.setStatus(&amp;quot;{msg}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;Token names can be literal or numeric characters, or both:
    &lt;pre class=&#034;codeSample&#034;&gt;[then]Print1 &amp;quot;{&lt;span class=&#034;error&#034;&gt;1&lt;/span&gt;}&amp;quot; = System.out.println(&amp;quot;{&lt;span class=&#034;error&#034;&gt;1&lt;/span&gt;}&amp;quot;);&lt;br /&gt;[then]Print2 &amp;quot;{&lt;span class=&#034;error&#034;&gt;msg&lt;/span&gt;}&amp;quot; = System.out.println(&amp;quot;{&lt;span class=&#034;error&#034;&gt;msg&lt;/span&gt;}&amp;quot;);&lt;br /&gt;[then]Print3 &amp;quot;{&lt;span class=&#034;error&#034;&gt;23msg&lt;/span&gt;}&amp;quot; = System.out.println(&amp;quot;{&lt;span class=&#034;error&#034;&gt;23msg&lt;/span&gt;}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;&amp;nbsp;If token on the left hand side has no quotes, and expression/function on the right hand side can accept parameter of type String, then the token can be placed between quotes on the right hand side:
    &lt;pre class=&#034;codeSample&#034;&gt;[then]PrintInteger {1} = System.out.println(&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;{1}&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;[then]PrintInteger2 {1} = printingFunction(&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;{1}&lt;span class=&#034;error&#034;&gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;&amp;nbsp;If you want to use declared variable in right hand side, make sure it is declared on the left hand side of the rule. Remember, DSL template is ONLY a template, it is a not a place to declare variables, declaration occurs only in DRL, DSL contains the expansion. Keep in mind that declaration and usage of the variable is per-rule basis:
    &lt;pre class=&#034;codeSample&#034;&gt;rule &amp;quot;set-hello&amp;quot;&lt;br /&gt;   when&lt;br /&gt;	Message&lt;br /&gt;   then&lt;br /&gt;	SetMessage &amp;quot;Hello&amp;quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;
    &lt;pre class=&#034;codeSample&#034;&gt;&lt;span class=&#034;error&#034;&gt;[when]&lt;/span&gt;Message = &lt;span class=&#034;error&#034;&gt;m&lt;/span&gt; : Message() //declare and initialize &#039;m&#039;&lt;br /&gt;&lt;span class=&#034;error&#034;&gt;[then]&lt;/span&gt;SetMessage &amp;quot;{msg}&amp;quot; = &lt;span class=&#034;error&#034;&gt;m&lt;/span&gt;.setStatus(&amp;quot;{msg}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;White spaces before the &amp;ldquo;=&amp;rdquo; and after are allowed when writing a DSL line:
    &lt;pre class=&#034;codeSample&#034;&gt;[then]SetMessage   &amp;quot;{msg}&amp;quot;  =    m.setStatus(&amp;quot;{msg}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
    &lt;li&gt;If you are using a function in the right hand side of the DSL of the expansion, then make sure you provide necessary imports in DRL source for all the objects the function is using. For example if your function gets a proxy to a JMS Queue from JBoss, then you have to include imports for all the objects associated with this operation, like you normally would do it in normal Java class. Also the function itself must be present in source DRL.&lt;/li&gt;
    &lt;li&gt;Left hand side of the rule, can evaluate boolean function instead of expression:
    &lt;pre class=&#034;codeSample&#034;&gt;rule &amp;quot;CheeseType&amp;quot;   &lt;br /&gt;   when	&lt;br /&gt;	Cheese is of type &amp;quot;silton&amp;quot;   &lt;br /&gt;   then	&lt;br /&gt;	DoSomething&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;function boolean &lt;br /&gt;	someEvaluatingFunction(Cheese cheese,String type) {&lt;br /&gt;   if (cheese.getType().equals(type))&lt;br /&gt;	return true;&lt;br /&gt;   else&lt;br /&gt;	return false;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
    &lt;pre class=&#034;codeSample&#034;&gt;[when]Cheese is of type &amp;quot;{1}&amp;quot; = &lt;br /&gt;chz:Cheese() eval(&lt;span class=&#034;error&#034;&gt;someEvaluatingFunction(chz, &amp;quot;{1}&amp;quot;)&lt;/span&gt;)&lt;br /&gt;[then]DoSomething = System.out.println(&amp;quot;Something&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
    &lt;/li&gt;
&lt;/ol&gt;
If you interested in additional examples of the DRL+DSL, you can have a look at &lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034;&gt;another short example&lt;/a&gt; that I wrote sometime ago. Also, please dont forget to have a look at the JBoss Rules manual that i mentioned earlier.&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;t=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;t=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/27/jboss_security_jmx_console.html&#034; rel=&#034;bookmark&#034; title=&#034;JBoss Security - JMX Console&#034;&gt;JBoss Security - JMX Console&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - Stop executing current agenda group and all rules&#034;&gt;Drools - Stop executing current agenda group and all rules&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          Few months ago I wrote a post that describes an example that uses source DRL in conjunction with DSL template. In the current post, I want to describe and show with few examples how to write DSL template - whats allowed and whats not.  Now, having said that, I want to say that I am not planning to repeat the whole ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;t=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;title=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&amp;amp;t=Drools - tutorial on writing DSL template&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>jboss</category>
    <category>java</category>
    <category>drools</category>
    <comments>http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html</guid>
    <pubDate>Fri, 24 Oct 2008 06:34:20 GMT</pubDate>
  </item>
  <item>
    <title>Drools - Stop executing current agenda group and all rules</title>
    <link>http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html</link>
	 <description>
        Sometimes, depends on your business rules in your application, there is a need to stop current agenda group or all rules from continuing to execute. It wont help setting a focus to another agenda group, since previous agenda will still remain in a stack. So in this post I want to show how to prevent rules in a particular agenda group from continuing to execute by clearing the agenda and also how to stop all rules totally.&lt;br /&gt;
&lt;br /&gt;
Please note, in this example I am using agenda-groups to drive execution flow.&lt;br /&gt;
&lt;br /&gt;
I created a short DRL file and a DSL template to demonstrate how clearing agenda and stopping of all rules can be achieved.&lt;br /&gt;
&lt;br /&gt;
The DRL file:
&lt;pre class=&#034;java:firstline[1]&#034; name=&#034;code&#034;&gt;expander template.dsl;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; First default rule to kick in&lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;baserule&amp;quot;&lt;br /&gt;salience 100000 &lt;br /&gt;auto-focus true&lt;br /&gt;agenda-group &amp;quot;first-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; Second rule to kick in &lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;1&amp;quot;&lt;br /&gt;salience 1000 &lt;br /&gt;agenda-group &amp;quot;first-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Goto agenda &amp;quot;second-group&amp;quot;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; Third rule to kick in&lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;2&amp;quot;&lt;br /&gt;salience 1000 &lt;br /&gt;agenda-group &amp;quot;second-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Do something   &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; Fourth rule to kick in&lt;br /&gt;&amp;nbsp;&lt;br /&gt; Current rule stops agenda &amp;quot;second-group&amp;quot; &lt;br /&gt; from continuing to execute, and the &lt;br /&gt; focus will be returned back to &lt;br /&gt; agenda &amp;quot;first-group&amp;quot;&lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;3&amp;quot;&lt;br /&gt;salience 900 &lt;br /&gt;agenda-group &amp;quot;second-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Stop agenda &amp;quot;second-group&amp;quot; //clear current agenda  &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; This rule never kicks in, since agenda&lt;br /&gt; &amp;quot;second-group&amp;quot; was cleared by rule &amp;quot;3&amp;quot;&lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;4&amp;quot;&lt;br /&gt;salience 800 &lt;br /&gt;agenda-group &amp;quot;second-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Do something   &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; Fifth rule to kick in&lt;br /&gt;&lt;br /&gt; After clearing agenda &amp;quot;second-group&amp;quot;, the&lt;br /&gt; focus will be returned here &lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;5&amp;quot;&lt;br /&gt;salience 900 &lt;br /&gt;agenda-group &amp;quot;first-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Do something&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; Sixth rule to kick in&lt;br /&gt; Current rule stops execution of all rules&lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;6&amp;quot;&lt;br /&gt;salience 800 &lt;br /&gt;agenda-group &amp;quot;first-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Stop all&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*****************************************&lt;br /&gt; This rule never kicks in, since all rules&lt;br /&gt; execution was stopped by rule &amp;quot;6&amp;quot; &lt;br /&gt;******************************************/&lt;br /&gt;rule &amp;quot;7&amp;quot;&lt;br /&gt;salience 700 &lt;br /&gt;agenda-group &amp;quot;first-group&amp;quot;&lt;br /&gt;when&lt;br /&gt;      True&lt;br /&gt;then&lt;br /&gt;      Do something&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;
The DSL template:
&lt;pre name=&#034;code&#034; class=&#034;java:firstline[1]&#034;&gt;[when]True=eval(true)&lt;br /&gt;[then]Do something=&lt;br /&gt;      System.out.println(&amp;quot;Doing something&amp;quot;);&lt;br /&gt;[then]Stop all=drools.halt();&lt;br /&gt;[then]Goto agenda &amp;quot;{agenda}&amp;quot;=&lt;br /&gt;      drools.setFocus( &amp;quot;{agenda}&amp;quot; );&lt;br /&gt;[then]Stop agenda &amp;quot;{agenda}&amp;quot;=&lt;br /&gt;      drools.getWorkingMemory().&lt;br /&gt;		clearAgendaGroup(&amp;quot;{agenda}&amp;quot;);&lt;br /&gt;&lt;/pre&gt;
Basically what happens is: once the execution reaches &lt;em&gt;rule &amp;quot;3&amp;quot;, &lt;/em&gt;I am calling for &lt;em&gt;clearAgendaGroup()&lt;/em&gt; method to clear agenda, hence to remove it from the stack. As a result of the clearing, &lt;em&gt;rule &amp;quot;4&amp;quot; &lt;/em&gt;will never be executed. &lt;br /&gt;
&lt;br /&gt;
When focus is returned back to agenda &lt;em&gt;&amp;quot;first-group&amp;quot;&lt;/em&gt;,&amp;nbsp; it lands on &lt;em&gt;rule &amp;quot;5&amp;quot;&lt;/em&gt;. When the execution reaches &lt;em&gt;rule &amp;quot;6&amp;quot;&lt;/em&gt;, I am calling for &lt;em&gt;drools.halt()&lt;/em&gt; method to stop execution of all rules. &lt;br /&gt;
&lt;br /&gt;
Keep in mind that in Drools 3 there is no &lt;em&gt;halt()&lt;/em&gt; method. It came with Drools 4. If you want to achieve the above result of stopping all rules in Drools 3, you can call for &lt;em&gt;drools.clearAgenda();&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
You noticed that I am using &amp;quot;drools&amp;quot; object and calling some methods on that object in my DSL template. Well &amp;quot;drools&amp;quot; object is actually &lt;em&gt;KnowledgeHelper&lt;/em&gt; class, which is part of Drools library. It provides several APIs, for example method halt(), setFocus() and&amp;nbsp; getWorkingMemory().&lt;br /&gt;
&lt;br /&gt;
Keep in mind that I did not actually tested these particular DRL and DSL, but this example is based on real scenario that I have tested.&lt;br /&gt;
&lt;br /&gt;
Comments/questions/flames are welcomed&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;t=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;t=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/27/jboss_security_jmx_console.html&#034; rel=&#034;bookmark&#034; title=&#034;JBoss Security - JMX Console&#034;&gt;JBoss Security - JMX Console&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          Sometimes, depends on your business rules in your application, there is a need to stop current agenda group or all rules from continuing to execute. It wont help setting a focus to another agenda group, since previous agenda will still remain in a stack. So in this post I want to show how to prevent rules in a ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;t=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;title=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html&amp;amp;t=Drools - Stop executing current agenda group and all rules&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <category>jboss</category>
    <category>java</category>
    <category>drools</category>
    <comments>http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2008/06/09/drools_stop_executing_current_agenda_group_and_all_rules.html</guid>
    <pubDate>Mon, 09 Jun 2008 06:36:00 GMT</pubDate>
  </item>
  <item>
    <title>Drools - working with Stateless session</title>
    <link>http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html</link>
	 <description>
        Drools (now it is also called JBoss Rules) is an amazing open source framework which allows you to create business rules management system for your application. I got introduced to Drools while working on a project at my current company. &lt;br /&gt;
&lt;br /&gt;
It is very easy to use and implement it and it is very efficient. For example instead of having dozens of if-else statements for some application business rules, you can use Drools to create a rule engine with your defined rules and pass your objects through the rule engine.&lt;br /&gt;
&lt;br /&gt;
For example, in your application that deals with student objects, you can create a rule that checks whether the student has paid his fees for the next semester, if not - send him/her reminder email... etc..&lt;br /&gt;
&lt;br /&gt;
In this example i want to show how to work with Stateless drools session to retrieve&amp;nbsp; results from the global variable. I know that at this point its a bit not clear,&amp;nbsp; so i will try to explain as I go... or you can simply visit their website, the link is under &amp;quot;Useful Links&amp;quot; section on the right hand side... &lt;br /&gt;
&lt;br /&gt;
In addition to that you can always join their IRC channel #drools, the drools team is very helpful and i owe my special thanks to a fellas name &lt;strong&gt;mic_hat &lt;/strong&gt;and &lt;strong&gt;conan&lt;/strong&gt; there, that had a lot of patience for me ;)&lt;br /&gt;
&lt;br /&gt;
For my example i prepared a simple POJO, DRL and DSL files and a test client.&lt;br /&gt;
DRL is the file that contains my rules. DSL is the expandable template for DRL.&lt;br /&gt;
&lt;br /&gt;
Drools allow you to write your rules using plain human language in DRL, and then in DSL template you can specify to what programming code the human sentence corresponds to. The following explains what I mean:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt; My DRL file with 2 rules in it:&lt;/strong&gt;&lt;br /&gt;
&lt;pre class=&#034;java:nocontrols:firstline[1]&#034; name=&#034;code&#034;&gt;package com.test.drools.rules;&lt;br /&gt;&lt;br /&gt;expander mydsl.dsl; &lt;br /&gt;&lt;br /&gt;import com.test.drools.entities.Pojo;&lt;br /&gt;&lt;br /&gt;global java.util.List list;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rule &amp;quot;1&amp;quot;&lt;br /&gt;salience 1000&lt;br /&gt;auto-focus true&lt;br /&gt;&lt;br /&gt;when&lt;br /&gt;      The blog name is &amp;quot;Java Beans dot Asia&amp;quot;	    &lt;br /&gt;then&lt;br /&gt;      Log &amp;quot;The blog name was matched&amp;quot;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rule &amp;quot;2&amp;quot;&lt;br /&gt;salience 900&lt;br /&gt;&lt;br /&gt;when&lt;br /&gt;      This post was created in &amp;quot;May&amp;quot;	    &lt;br /&gt;then&lt;br /&gt;      Log &amp;quot;The blog post month was matched&amp;quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;
&amp;quot;&lt;em&gt;expander mydsl.dsl&lt;/em&gt;&amp;quot; - file name of my DSL template.&lt;br /&gt;
&amp;quot;&lt;em&gt;global java.util.List list&lt;/em&gt;&amp;quot; - a global variable, which is the type of List. Global variable you can use for storing some results, log messages and even objects.&lt;br /&gt;
&amp;quot;&lt;em&gt;salience&lt;/em&gt;&amp;quot; - the priority which rules should be executed first.&lt;br /&gt;
&amp;quot;&lt;em&gt;auto-focus&lt;/em&gt;&amp;quot; - the rule that has auto-focus will get executed first, basically the starting point of execution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt; My DSL template file for my DRL:&lt;/strong&gt;
&lt;pre class=&#034;java:nocontrols:firstline[1]&#034; name=&#034;code&#034;&gt;[condition][]The blog name is &amp;quot;{name}&amp;quot;=&lt;br /&gt;	poj : Pojo( blogName == &amp;quot;{name}&amp;quot;)&lt;br /&gt;&lt;br /&gt;[condition][]This post was created in &amp;quot;{month}&amp;quot;=&lt;br /&gt;	poj : Pojo( postMonth == &amp;quot;{month}&amp;quot;)&lt;br /&gt;&lt;br /&gt;[consequence][]Log &amp;quot;{message}&amp;quot;=&lt;br /&gt;	list.add(new String(&amp;quot;{message}&amp;quot;));&lt;/pre&gt;
As you can see &amp;quot;&lt;em&gt;This post was created in &amp;quot;arg&lt;/em&gt;&amp;quot;&amp;quot; will expands into &amp;quot;&lt;em&gt;poj : Pojo( postMonth == &amp;quot;{month}&amp;quot;)&lt;/em&gt;&amp;quot;, where the value of &amp;quot;&lt;em&gt;arg&lt;/em&gt;&amp;quot; will be compared to the value of &lt;em&gt;postMonth &lt;/em&gt;variable in my POJO.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that you do not have to use DSL template, you can use only DRL file if you want to and have your source code there. Using the template makes your rules very readable. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;My POJO:&lt;/strong&gt;&lt;br /&gt;
&lt;pre name=&#034;code&#034; class=&#034;java:nocontrols:firstline[1]&#034;&gt;package com.test.drools.entities;&lt;br /&gt;&lt;br /&gt;import java.io.Serializable;&lt;br /&gt;&lt;br /&gt;public class Pojo implements Serializable {&lt;br /&gt;&lt;br /&gt;	private String blogName;&lt;br /&gt;	private String postMonth;&lt;br /&gt;&lt;br /&gt;	public Pojo() {&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public String getBlogName() {&lt;br /&gt;		return blogName;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public void setBlogName(String blogName) {&lt;br /&gt;		this.blogName = blogName;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public String getPostMonth() {&lt;br /&gt;		return postMonth;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public void setPostMonth(String postMonth) {&lt;br /&gt;		this.postMonth = postMonth;&lt;br /&gt;	}&lt;br /&gt;}&lt;/pre&gt;
&lt;strong&gt; My client:&lt;/strong&gt;&lt;br /&gt;
&lt;pre class=&#034;java:nocontrols:firstline[1]&#034; name=&#034;code&#034;&gt;package com.test.drools.client;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.io.Reader;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.Iterator;&lt;br /&gt;import java.util.List;&lt;br /&gt;&lt;br /&gt;import org.drools.RuleBase;&lt;br /&gt;import org.drools.RuleBaseFactory;&lt;br /&gt;import org.drools.StatelessSession;&lt;br /&gt;import org.drools.StatelessSessionResult;&lt;br /&gt;import org.drools.base.CopyIdentifiersGlobalExporter;&lt;br /&gt;import org.drools.compiler.DroolsError;&lt;br /&gt;import org.drools.compiler.DroolsParserException;&lt;br /&gt;import org.drools.compiler.PackageBuilder;&lt;br /&gt;import org.drools.compiler.PackageBuilderErrors;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import com.test.drools.entities.Pojo;&lt;br /&gt;&lt;br /&gt;public class Client {&lt;br /&gt;&lt;br /&gt;//path to the DRL file inside my JAR&lt;br /&gt;final static String DRL_URL = &lt;br /&gt;		&amp;quot;/com/test/drools/rules/mydrl.drl&amp;quot;;&lt;br /&gt;//path to the DSL file inside my JAR&lt;br /&gt;final static String DSL_URL = &lt;br /&gt;		&amp;quot;/com/test/drools/rules/mydsl.dsl&amp;quot;;&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;   //Instantiate and initialize the POJO.&lt;br /&gt;   Pojo p1 = new Pojo();&lt;br /&gt;   p1.setBlogName(&amp;quot;Java Beans dot Asia&amp;quot;);&lt;br /&gt;   p1.setPostMonth(&amp;quot;May&amp;quot;);&lt;br /&gt;&lt;br /&gt;   //Calling for private method to compile a RuleBase&lt;br /&gt;   RuleBase ruleBase = getRuleBase();&lt;br /&gt;&lt;br /&gt;   //Instantiating StatelessSession&lt;br /&gt;   StatelessSession session = &lt;br /&gt;			ruleBase.newStatelessSession();&lt;br /&gt;&lt;br /&gt;   //Setting global variable:&lt;br /&gt;   //the name &#039;list&#039; is the same name mentioned in DRL:&lt;br /&gt;   //global java.util.List list;&lt;br /&gt;   session.setGlobal(&amp;quot;list&amp;quot;, list);&lt;br /&gt;&lt;br /&gt;   //specifying the global name that should be exported&lt;br /&gt;   session.setGlobalExporter( &lt;br /&gt;   new CopyIdentifiersGlobalExporter( &lt;br /&gt;				new String[]{&amp;quot;list&amp;quot;} ) );&lt;br /&gt;&lt;br /&gt;   //executeWithResults() - stores execution results in &lt;br /&gt;   //StatelessSessionResult object. That objects will &lt;br /&gt;   //contain our global variable with results, that we &lt;br /&gt;   //can use after the execution of stateless &lt;br /&gt;   //session is finished.&lt;br /&gt;   StatelessSessionResult result = &lt;br /&gt;			session.executeWithResults(p1);&lt;br /&gt;&lt;br /&gt;   //get global variable and cast back to &lt;br /&gt;   //the type of List&lt;br /&gt;   List retrievedList = (List) result.getGlobal(&amp;quot;list&amp;quot;);&lt;br /&gt;&lt;br /&gt;   if (retrievedList != null &amp;amp;&amp;amp; &lt;br /&gt;			retrievedList.size() &amp;gt; 0) {&lt;br /&gt;&lt;br /&gt;   for (Iterator i = retrievedList.iterator(); &lt;br /&gt;					i.hasNext();) {&lt;br /&gt;	System.out.println((String) i.next());&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private static RuleBase getRuleBase() {&lt;br /&gt;&lt;br /&gt;//Create a new package builder&lt;br /&gt;PackageBuilder builder = new PackageBuilder();&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;&lt;br /&gt;//call for private method to get the DRL&lt;br /&gt;Reader drl = getSourceDrl();&lt;br /&gt;&lt;br /&gt;//call for private method to get the DSL&lt;br /&gt;Reader dsl = getDsl();&lt;br /&gt;&lt;br /&gt;//Add rule package to the builder using drl and &lt;br /&gt;//dsl Reader objects&lt;br /&gt;builder.addPackageFromDrl(drl, dsl);&lt;br /&gt;&lt;br /&gt;//Check whether our DRL and DSL files had any &lt;br /&gt;//errors when trying to create a rule package. &lt;br /&gt;//If DRL and/or DSL had any errors we wont be able &lt;br /&gt;//to create a rule package and a new RuleBase.&lt;br /&gt;PackageBuilderErrors errors = builder.getErrors();&lt;br /&gt;&lt;br /&gt;DroolsError[] error = errors.getErrors();&lt;br /&gt;&lt;br /&gt;if (error.length &amp;gt; 0) {&lt;br /&gt;for (DroolsError err : error) {&lt;br /&gt;System.out.println(&amp;quot;Errors are: &amp;quot; + err.getMessage());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;} catch (DroolsParserException e1) {&lt;br /&gt;e1.printStackTrace();&lt;br /&gt;} catch (IOException e1) {&lt;br /&gt;e1.printStackTrace();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Get new RuleBase object. RuleBase is where &lt;br /&gt;//we will get Stateless session object from.&lt;br /&gt;RuleBase ruleBase = RuleBaseFactory.newRuleBase();&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;//Add package with our rules to the RuleBase.&lt;br /&gt;//This is when the RuleBase is actually compiled&lt;br /&gt;ruleBase.addPackage(builder.getPackage());&lt;br /&gt;} catch (Exception e1) {&lt;br /&gt;e1.printStackTrace();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return ruleBase;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static Reader getDsl() &lt;br /&gt;			throws IOException {&lt;br /&gt;return new InputStreamReader(Client.class&lt;br /&gt;.getResourceAsStream(DSL_URL));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static Reader getSourceDrl() &lt;br /&gt;			throws IOException {&lt;br /&gt;return new InputStreamReader(Client.class&lt;br /&gt;.getResourceAsStream(DRL_URL));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
I will try to give now a brief explanation&amp;nbsp; what is actually happening:&lt;br /&gt;
When &lt;em&gt;session.executeWithResults(p1); &lt;/em&gt;is executes, rule engine will apply the rules on a p1 POJO object. If rules will be matched, then the result will be stored in the global variable. &lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
If value&lt;em&gt; &lt;/em&gt;of &lt;em&gt;&amp;quot;blogName&amp;quot; &lt;/em&gt;variable inside my p1 POJO object will be equal to &amp;quot;&lt;em&gt;Java Beans dot Asia&lt;/em&gt;&amp;quot;, then the rule#1 in my DRL will be matched, and the result &amp;quot;&lt;em&gt;The blog name was matched&lt;/em&gt;&amp;quot; will be stored in my global List.&lt;br /&gt;
&lt;br /&gt;
The final output of the program will be as follows:
&lt;pre class=&#034;java:nocontrols:firstline[1]&#034; name=&#034;code&#034;&gt;&amp;quot;The blog name was matched&amp;quot;&lt;br /&gt;&amp;quot;The blog post month was matched&amp;quot;&lt;/pre&gt;
This example was very simple, I had only two rules where i did comparison of String literals. But Drools definitely has the capability to create a friendly business rule system with thousands of rules if needed, while staying user friendly for both developers and business clients. I think its worth while checking it out :)&lt;br /&gt;
&lt;br /&gt;
I&#039;ve included a source code and jUnit test case for this tutorial if you want to have a look at it and try it your self.&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;t=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;t=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Related Posts&lt;/b&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/01/drools_5_case_study_2_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 2 - Complex Event Processing&#034;&gt;Drools 5 Case Study 2 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/09/05/rule_engine_stress_testing.html&#034; rel=&#034;bookmark&#034; title=&#034;Rule Engine Stress Testing&#034;&gt;Rule Engine Stress Testing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/22/brainteaser_drools_testing_objects.html&#034; rel=&#034;bookmark&#034; title=&#034;Brainteaser Drools: Testing Objects&#034;&gt;Brainteaser Drools: Testing Objects&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/23/feedback_by_the_drools_team.html&#034; rel=&#034;bookmark&#034; title=&#034;Feedback by the Drools Team&#034;&gt;Feedback by the Drools Team&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/27/jboss_security_jmx_console.html&#034; rel=&#034;bookmark&#034; title=&#034;JBoss Security - JMX Console&#034;&gt;JBoss Security - JMX Console&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/29/drools_5_case_study_1_writing_dsl_for_drl_rule.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 Case Study 1- Writing DSL for DRL rule&#034;&gt;Drools 5 Case Study 1- Writing DSL for DRL rule&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2009/08/31/drools_5_complex_event_processing.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools 5 - Complex Event Processing&#034;&gt;Drools 5 - Complex Event Processing&lt;/a&gt;&lt;br /&gt;&lt;a href=&#034;http://javabeans.asia/2008/10/24/drools_tutorial_on_writing_dsl_template.html&#034; rel=&#034;bookmark&#034; title=&#034;Drools - tutorial on writing DSL template&#034;&gt;Drools - tutorial on writing DSL template&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;</description>
	<!--
    <description>
          Drools (now it is also called JBoss Rules) is an amazing open source framework which allows you to create business rules management system for your application. I got introduced to Drools while working on a project at my current company.   It is very easy to use and implement it and it is very efficient. For example ...&lt;p&gt;&lt;a href=&#034;http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034;&gt;Read more...&lt;/a&gt;&lt;/p&gt;&lt;div class=&#034;tags&#034;&gt;&lt;span&gt;Social Bookmarks : &lt;/span&gt;&amp;nbsp;&lt;a href=&#034;http://slashdot.org/bookmark.pl?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Slash Dot&#034;&gt;&lt;img src=&#034;common/images/slashdot.png&#034; alt=&#034;Add this post to Slashdot&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://digg.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Digg this post&#034;&gt;&lt;img src=&#034;common/images/digg.png&#034; alt=&#034;Add this post to Digg&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://reddit.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Reddit&#034;&gt;&lt;img src=&#034;common/images/reddit.png&#034; alt=&#034;Add this post to Reddit&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://del.icio.us/post?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Save this post to Del.icio.us&#034;&gt;&lt;img src=&#034;common/images/delicious.png&#034; alt=&#034;Add this post to Delicious&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.stumbleupon.com/submit?url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Stumble this post&#034;&gt;&lt;img src=&#034;common/images/stumbleupon.png&#034; alt=&#034;Add this post to Stumble it&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.google.com/bookmarks/mark?op=edit&amp;amp;bkmk=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Google&#034;&gt;&lt;img src=&#034;common/images/google.png&#034; alt=&#034;Add this post to Google&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://technorati.com/faves?add=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Technorati&#034;&gt;&lt;img src=&#034;common/images/technorati.png&#034; alt=&#034;Add this post to Technorati&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.bloglines.com/sub/http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Bloglines&#034;&gt;&lt;img src=&#034;common/images/bloglines.png&#034; alt=&#034;Add this post to Bloglines&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.facebook.com/share.php?u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&#034; target=&#034;_blank&#034; title=&#034;Add this post to Facebook&#034;&gt;&lt;img src=&#034;common/images/facebook.png&#034; alt=&#034;Add this post to Facebook&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://www.furl.net/storeIt.jsp?u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;t=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Furl&#034;&gt;&lt;img src=&#034;common/images/furl.png&#034; alt=&#034;Add this post to Furl&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;amp;url=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;title=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Windows Live&#034;&gt;&lt;img src=&#034;common/images/windowslive.png&#034; alt=&#034;Add this post to Windows Live&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&#034;http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;amp;u=http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html&amp;amp;t=Drools - working with Stateless session&#034; target=&#034;_blank&#034; title=&#034;Add this post to Yahoo!&#034;&gt;&lt;img src=&#034;common/images/yahoo.png&#034; alt=&#034;Add this post to Yahoo!&#034; border=&#034;0&#034; /&gt;&lt;/a&gt;&lt;/div&gt;</description>
      
	-->
    <enclosure url="http://javabeans.asia/files/src/drools_working_with_stateless_session.zip" length="4888" type="application/zip" />
    <category>jboss</category>
    <category>java</category>
    <category>drools</category>
    <comments>http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html#comments</comments>
    <guid isPermaLink="true">http://javabeans.asia/2008/05/11/drools_working_with_stateless_session.html</guid>
    <pubDate>Sun, 11 May 2008 00:01:00 GMT</pubDate>
  </item>
  </channel>
</rss>
