[rules-users] Share 'declare' by adding drl to KnowledgeBuilder?

Barry Kaplan groups1 at memelet.com
Sat Aug 29 22:20:24 EDT 2009


I have a drl that only contains a declare statement. When I load a drl
containing rules I also load that drl. But when the rule executes I get an
error which is the same as if I didn't have the declare.

When I debug and check the PackageDescr for the drl containing the 'declare'
the TypeDeclarationDescr is in the package and seems to have the correct
values.

Both the rule and the drl with the 'declare' are in the same package:

declartions.drl:
-----------
package memelet.droolsesper

import memelet.droolsesper.MarketDataEvent

declare MarketDataEvent
	@role(event)
	@expires(10s)
end
-----------

rule.drl:
-----------
package memelet.droolsesper

import memelet.droolsesper.ArrivalRate

global ArrivalRate arrivalRate

rule "How do I measure the rate of arrival of events in a given time
period?"
/*
 select count(*) as cnt from MarketDataEvent.win:time_batch(1 second)
*/
/*
 5.0.1 does not support 'time_batch', so the best we can do is capture the
 continous count. 
*/
when
    $rate : Long() from accumulate ( 
        $e: MarketDataEvent() over window:time(1s) from entry-point
"stream", count($e))
    
then
    arrivalRate.value = $rate;
end
-----------

-- 
View this message in context: http://www.nabble.com/Share-%27declare%27-by-adding-drl-to-KnowledgeBuilder--tp25208077p25208077.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list