1 Reply Latest reply on Aug 31, 2010 10:01 AM by krisverlaenen

    Message Events in statefully flows

    rlovell

      Hi

       

      I have a stateful drools flow that has multiple facts that are all waiting for an event to occur in order for it to move to the next stage see attached diagram.  My Question is how do I link the events coming in to the fact that correlates to it in order that only the correct fact moves to the next stage of the flow.

       

      Thanks

       

      Rob

        • 1. Re: Message Events in statefully flows
          krisverlaenen

          Rob,

           

          You should signal your flow about the occurence of an event using processInstance.signalEvent(name, value);

          So the problem is, how do I find the right process instance to signal?

           

          Drools Flow currently does not allow for automatic correlation of messages.  You can however use the processInstanceId for correlation purposes:

           

          a) store the process instance id as part of your domain model, when the event occurs due to a change of one of your facts, you can simply retrieve the process instance id from the fact

           

          b) you can maintain a separate table that maps process instance id to some other domain data (like for example a fact id), so that you can lookup the process instance id like this.

           

          We'll be looking at how to provide more automatic correlation mechanisms as part of the BPMN2 implementation.

           

          Kris