[jboss-user] [jBPM] - Continue process Instance

marcosdutto do-not-reply at jboss.com
Tue Jul 10 09:59:43 EDT 2012

marcosdutto [https://community.jboss.org/people/marcosdutto] created the discussion

"Continue process Instance"

To view the discussion, visit: https://community.jboss.org/message/747226#747226

I have a simple process with 3 User Tasks. I am trying to load the session and continue with the process but it doesn't work.
When i complete a task from a process created in the same execution of the program it works. But when I complete a User task from a process saved previously it doesn't work. I think that the task is completed but jbpm doesn't know where it has to continue or something like that.

Doing a test i use the lines:
          processInstance2 =  (RuleFlowProcessInstance) ksession.getProcessInstance(XX);
          NodeInstance nodeInstance = processInstance2.getNodeInstance();

and the node Instance is always an instance from the first User Task. Moreover, being at the second Task of my processInstance i saved the session after that i loaded that session and the same thing happened (the node Instance was an instance from the first User Task).

This is my piece of code:

public static final void main(String[] args) throws Exception {        
        KnowledgeBase kbase = readKnowledgeBase();
        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );
        Environment env = KnowledgeBaseFactory.newEnvironment();
        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
        StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(2, kbase, null, env );
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new CommandBasedWSHumanTaskHandler(ksession));
        JPAWorkingMemoryDbLogger dblogger = new JPAWorkingMemoryDbLogger(ksession);
        Map<String, Object> params = new HashMap<String, Object>();
        ksession.addEventListener(new GecosProcessListener());
        ksession.signalEvent("Trigger", null);
        RuleFlowProcessInstance processInstance =  (RuleFlowProcessInstance) ksession.startProcess("simple",params);
        System.out.println("Id session: "+ksession.getId());
        System.out.println("Process Instances: "+ksession.getProcessInstances().size());
        System.out.println("Process Instance ID: "+processInstance.getId());


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120710/9ff30eda/attachment.html 

More information about the jboss-user mailing list