[rules-users] completing persisted workItem (the last in a process) doesn't complete a process

gs76pl gstasica at pacemetrics.com
Tue Apr 12 08:14:34 EDT 2011


hi,

two updates to the previous post:

1. it looks like the reason why i can't see the process status changed to
COMPLETED is because of something going wrong with JPA and what a session
obtained using its API can see i.e.

my custom work item code looks like below:

public void executeWorkItem(final WorkItem workItem, final WorkItemManager
workItemManager)
  
  Thread t = new Thread(){
	@Override
	public void run()
	{
		// here come my custom code


		//this is the same knowledgeSession i got during session creation
		knowledgeSession.getWorkItemManager().completeWorkItem(workItem.getId(),
action.getResults());
	}
  };

  t.start();
  
}

so basically i spawn a new tread to have the action executed async. and once
done i mark the workItem as completed. What i've noticed when debuging the
whole code is that completing the workItem [b]does indeed[/b] set the
process status to COMPLETED but somehow this change isn't visible by the
thread the whole process has been kicked off. Another interesting thing is
that if i run the whole process using session obtained as below
ksession = kbase.newStatefulKnowledgeSession (and not by using persistence
api i.e. ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null,
getEnvironment()) ; )

everything works fine
2. i figured out that the sessioninfo isn't cleared because my code doesn't
call ksession.dispose() method

--
View this message in context: http://drools.46999.n3.nabble.com/completing-persisted-workItem-the-last-in-a-process-doesn-t-complete-a-process-tp2810593p2811155.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list