[rules-users] Drools 6 problem with events when using "after"

Jan Šťastný newohybat at gmail.com
Tue May 13 10:47:07 EDT 2014


Hi,
I use rules together with processes. One global process signals the 
TurnEvent to other processes in the working memory.

    declare TurnEvent
         @role(event)
    end

Then, when started a process, which waits for TurnEvent another event is 
signaled - the ProcessWaitsForTurnEvent

    declare ProcessWaitsForTurnEvent
         @role(event)
         processId:Long
    end

signalled in rule

    rule "Build Unit Process Waits For Turn"
         salience 50
         when
             WorkflowProcessInstance(
    getProcessId()=="cz.muni.fi.civ.newohybat.bpmn.buildUnit"
                 ,$processId:id
             )
             not ProcessWaitsForTurnEvent(processId==$processId)
         then
             insert(new ProcessWaitsForTurnEvent($processId));
    end


Then there is the last rule which signals each TurnEvent for which there 
is ProcessWaitsForTurnEvent for a Process:

    rule "Signal New Turn"
         dialect "mvel"
         when
             $pi:ProcessWaitsForTurnEvent(
                 $processId:processId
             )
             TurnEvent(this after $pi) from entry-point "GameControlStream"
         then
    kcontext.getKnowledgeRuntime().signalEvent("turn-new",null,$processId);
    end

On my machine, everything works fine.
I tried that also on another, less powerful 32-bit machine and tests 
fails on following issue.
When I run my test case, where I create the process the "Build Unit 
Process Waits For Turn" fires, ProcessWaitsForTurnEvent is inserted, but 
then I insert TurnEvent, "Signal New Turn" is not fired. I am quite 
desperate, cause I have even tried to set @expires attribute for 
ProcessWaitsForTurnEvent to prevent earlier expiration, with no succes.

Any suggestion appreciated.
Thanks.
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140513/110f9b5e/attachment-0001.html 


More information about the rules-users mailing list