[rules-users] ProcessEventListener event order

Kris Verlaenen Kris.Verlaenen at cs.kuleuven.be
Fri Sep 10 07:41:18 EDT 2010


Carlos,

We are explicitly sending out before and after events to make sure you
can figure out which events are the result of what other events.  This
allows us to recreate a tree-view of events (e.g. see the audit logger).
 The order you are seeing is normal, let me try to explain.

If you have a sequence of 2 nodes, the events generated by this will be:

beforeNodeTriggered A
beforeNodeLeft A
beforeNodeTriggered B
...
afterNodeTriggered B
afterNodeLeft A
afterNodeTriggered A

Since execution is synchronous (unless you are using async nodes), this
means that the after event will only occur once the thread of control
returns back to that node, so after all following sync nodes have been
executed.

You can get your expected behaviour by logging on beforeNodeTriggered
and beforeNodeLeft.

Kris

Quoting Carlos Villegas <cav at uniscope.jp>:

>   Hi,
> 
> I'm testing the ProcessEventListener on a simple process and I get
> the 
> "after" events in reverse order.
> For example,
> 
> Process completed : 1283915643204
> Node left: 5: 1283915643268
> Node triggered: 5: 1283915643268
> Node left: 4: 1283915643268
> Node triggered: 4: 1283915643269
> Node left: 3: 1283915643269
> Node triggered: 3: 1283915643270
> Node left: 2: 1283915643270
> Node triggered: 2: 1283915643270
> Node left: 1: 1283915643270
> Node triggered: 1: 1283915643271
> Node left: 0: 1283915643271
> Node triggered: 0: 1283915643271
> Process started : 1283915643271
> 
> I'm just printing the node id and the time in milliseconds.
> 
> Is this the way is supposed to be?
> 
> I guess technically "after" could be anytime after, but if I use the
> 
> afterProcessStarted event, I get it after the whole process has 
> completed!, which it's not useful at all.
> The "before" events work as expected I think.
> 
> I'm using Drools Flow 5.1.0.
> 
> Thanks,
> Carlos
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the rules-users mailing list