[rules-users] DROOLS Flow as a Manufacturing process execution engine - Noob questions about events and concurrency

Mark Proctor mproctor at codehaus.org
Wed Apr 14 13:41:36 EDT 2010


On 09/04/2010 08:52, jeanjvr wrote:
> Salaboy,
>
> I put up a new simple diagram with red markers to show what I mean:
>
> http://i349.photobucket.com/albums/q388/shooter_za/loop.jpg
>
> http://n3.nabble.com/file/n707815/loop.jpg
>    
I'm just looking at those flow diagrams. You may find some of that logic 
can be modelled better and in a less brittle way with rules.
>
>
> 1. Regarding concurrency. What I mean is that after I use an AND split node,
> the flows going out from it will execute on their own paths at the same
> time? I assume that DROOLS Flow achieves this in the engine with multiple
> threads (in the background of the engine that we don't see)?
>    
No, it's single threaded. In general the execution of a path is "almost 
instant" spinning of threads for such short running work is normally 
more overhead. Instead we recommend that if anything is not "almost 
intant" to run it as an async action in it's own thread.
>
> 2. Regarding control loops. I mean here that according to the way I set up
> the flow that a loop will be constructed in the logic with certain flows
> executing multiple times. The motivation for this is that in manufacturing
> more than one product is assembled in a run, and this is where the loops in
> logic come from. I don't think I need a dedicated "for each" construct, but
> I may be wrong. If you look at my DROOLS flow image, you'll see that I've
> modeled three such "loops" into my flow and outlined one in the diagram
> above. The compiler validates my flow as legal, I'm wondering if this is
> really allowed in DROOLS.
>    
You'll find such loops make for quite brittle workflow, rules is 
probably better.
>
> 3. Regarding the Events. In the diagram you can see I outlined an example of
> two Events that are attached to an AND Join node. As I understand it, all
> flows going into the AND Join node should be completed before it can
> continue. Two of my flows here are Events. So in this example I want the one
> "normal flow" to enter the AND Join node and at some later time when both
> Events have fired I need the outgoing flow to continue.
>
> When I run the process, it does not wait until the two Event nodes have
> fired, it just executes until the AND Join node is encountered and the
> overall process exists.
>    
Each incoming event is effectively it's own propagation, the engine has 
no way of knowing they should be "joined" together.

Mark
> Jean
>
>
>
>
> jeanjvr wrote:
>    
>>
>> I attach a PNG image
>> (http://i349.photobucket.com/albums/q388/shooter_za/jvr_test_flow.png) and
>> a trimmed log of my flow just for interest sake at the end.
>>
>> My test Java app starts the flow in a new thread and allows me to trigger
>> events in the flow with buttons (processInstance.signalEvent(String type,
>> Object data)). If I use Drools in my project, the events would be
>> generated by factory devices through an industrial protocol called OPC.
>>
>>
>> Some noob questions:
>>
>> 1. I need concurrent execution in my flow. I use Split nodes to do this.
>> Is this the correct way to achieve concurrency?
>>
>> 2. I need to construct control loops. Pieces of the flow that execute over
>> and over until a constraint
>> directs flow to an End node. I see no reason why loops cannot be done in
>> DROOLS flow.
>>
>> 3. My biggest problem at this time is that my flow executes, but "ignores"
>> Event nodes connected to AND Join nodes. The work-flow then ends and my
>> thread exits, although the End nodes in question are not reached according
>> to the log.
>>
>> I suppose the engine determines that no terminating End node can be
>> reached and stops. I think that I maybe have an incorrect understanding of
>> some aspect of the DROOLS work-flow engine.
>>
>> The core idea is to let one or more flows reach an AND Join node - and
>> then wait until all Event nodes attached to the AND Join node is
>> triggered, allowing the flow to continue.
>>
>> Other problems I will not list here now, as I believe I may be able to
>> figure them out (variables, constraints). I just want to prove that Flow
>> can be used.
>>
>>
>>      
>    





More information about the rules-users mailing list