[rules-users] Help on writing a rule

Davide Sottara dsotty at gmail.com
Tue Oct 22 16:40:35 EDT 2013


Am I wrong or do you have two PriceChange events - 392 and 394 ?
If so, you can expect two activations.. when you fire al rules, one of
the two
will insert the OrderCreated, which in turn will cancel the other
 
On 10/22/2013 01:34 PM, calcacuervo wrote:
> Hi Guys. I have one quesiton on how could I implement my rule.
> I have this rule:
> when
> 		t : PriceChange() over window:length(1)
> 		signal : Signal( id == "1234" ) over window:length(1)
> 		not OrderCreated( id == "1234" ) over window:time (1m)
> 	then
>                 insert(new OrderCreated("1234));
>
> Basically, when there is some signal and some price change, create a new
> order if  there has no been any other order in the last minute.
> But this sometimes is being fired twice:
> 12:31:01,121 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange
> [](392); signal=Signal at 1413ddef(393)
> 12:31:01,160 INFO  [org.drools.audit.WorkingMemoryConsoleLogger] (Camel
> (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED
> rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange
> [](394); signal=Signal at 1413ddef(393)
>
> I think that, when the 1m window have passed, it creates twice the
> activations, as I have not called fire all rules yet. Does is make sense? Do
> you have some idea on how could I implement this rule? "when there has been
> some price change and some signal, and I did not create a new order in the
> last minute, just create a new order".
>
> Thanks in advance!
>
> Demian
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list