Currently, the reference to the subflow indeed needs to be explicitly
specified in the ruleflow. Once we have ruleflow variable support, it
will
be possible to use a variable that contains the name of the process to
start. But that is currently not yet supported.
However, as you have noticed correctly, you can just use
drools.getWorkingMemory().startProcess() inside your rules to start a
subflow. However, this call will return once the process has been started
(and possibly already finished but this is usually not the case). If you
want to wait until the subflow process has been terminated, you should
probably register a RuleFlowListener that updates the working memory with
some kind of event if a subflow has been completed, and use a milestone
node
to wait for that event before continuing with the cleanup. Basically,
this
is almost the same as how it is implemented internally.
Kris
----- Original Message -----
From: "james_d" <jamesdull(a)gmail.com>
To: <rules-users(a)lists.jboss.org>
Sent: Friday, November 02, 2007 9:45 PM
Subject: [rules-users] Dynamically selecting a subflow at runtime
>
> Hi,
>
> When creating a ruleflow, is there a mechanism that allows me to select
> which subflow is executed at runtime? I don't want to have to hardcode a
> specific subflow in the Ruleflow GUI/editor.
>
> Here's a contrived example of what I'm attempting to do:
>
> If the following subflows exist: bake cookies, "bake pizza", "grill
> steaks",
> "fry fish", etc., I'd like to have a ruleflow with the following
> rulegroups: |Start| -> Get Order -> Make food -> Cleanup -> |Repeat|.
> For
> a
> requested order, the corresponding subflow is invoked at the "Make food"
> stage then the process repeats.
>
> I saw that calling drools.getWorkingMemory().startProcess(...) might be
> an
> option, however I'm not sure that this will return control to the
> original
> ruleflow when done (causing the "Cleanup" group to not get executed). If
> I
> try to use the subflow widget in the Ruleflow GUI I have to explicitly
> name
> the subflow I want invoked.
>
> thank you
>
>
> --
> View this message in context:
>
http://www.nabble.com/Dynamically-selecting-a-subflow-at-runtime-tf472843...
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users