I have a flow: start -- User Task - Rule Task - User Task - Action - end.
I complete the 1st User Task, next the rules which are part of the
RuleFlowGroup in the Rule Task fire correctly, then I complete the next User
Task. However, my final action node is never reached and the processInstance
never completes.
Here is my Rule Flow:
?xml version="1.0" encoding="UTF-8"?>
<process
xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="droolsflow"
id="org.plugtree.labs.droolsflow"
package-name="org.plugtree.labs"
<header
<imports
<import
name="org.plugtree.labs.variablepersistence.MyEntity" /
<import
name="org.plugtree.labs.variablepersistence.MyVariableSerializable" /
</imports
</header
<nodes
<ruleSet id="17"
name="ruleMe" x="410" y="123" width="80"
height="48"
ruleFlowGroup="fox" /
<start id="1"
name="Start" x="16" y="16" width="48"
height="48" /
<end id="3"
name="End" x="665" y="312" width="48"
height="48" /
<humanTask id="23"
name="User Task" x="279" y="237" width="100"
height="48"
<work name="Human
Task"
<parameter
name="ActorId"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Comment"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Content"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Priority"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Skippable"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="TaskName"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
</work
</humanTask
<humanTask id="22" name="User Task"
x="145" y="86" width="100"
height="48"
<work name="Human
Task"
<parameter
name="ActorId"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Comment"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Content"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Priority"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="Skippable"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
<parameter name="TaskName"
<type
name="org.drools.process.core.datatype.impl.type.StringDataType" /
</parameter
</work
</humanTask
<actionNode id="12" name="Finish"
x="494" y="254" width="80" height="48"
<action type="expression"
dialect="mvel"
>System.out.println("Finished!!!");</action
</actionNode
</nodes
<connections
<connection
from="22" to="17" /
<connection from="12" to="3" /
<connection from="17" to="23" /
<connection from="1" to="22" /
<connection from="23" to="12" /
</connections
</process
And test code:
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( new ClassPathResource(
"VariablePersistenceStrategyProcess.rf" ), ResourceType.DRF );
kbuilder.add( new ClassPathResource( "myRules.drl" ),
ResourceType.DRL );
for (KnowledgeBuilderError error: kbuilder.getErrors()) {
System.out.println(error);
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
int id = ksession.getId();
System.out.println("### Starting process ###");
WorkflowProcessInstance processInstance = (WorkflowProcessInstance)
ksession.startProcess( "org.plugtree.labs.droolsflow"
/*,parameters*/ );
TestWorkItemHandler handler = TestWorkItemHandler.getInstance();
WorkItem workItem = handler.getWorkItem();
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession( id,
kbase, null, env );
processInstance = (WorkflowProcessInstance)
ksession.getProcessInstance( processInstance.getId() );
ksession.getWorkItemManager().completeWorkItem( workItem.getId(),
null );
workItem = handler.getWorkItem();
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(id,
kbase, null, env);
processInstance = (WorkflowProcessInstance)
ksession.getProcessInstance(processInstance.getId());
System.out.println("### Completing second work item ###");
ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
--
View this message in context:
http://n3.nabble.com/ProcessInstance-Does-Not-Complete-With-User-Task-and...
Sent from the Drools - User mailing list archive at
Nabble.com.