0 Replies Latest reply on Aug 19, 2014 4:23 AM by jhouzard

    Restart jbpm workflow

    jhouzard

      Hi,

       

      I'm implementing an asynchronous task. To do that I don't call the WorkItemManager.completeWorkItem method in my bpmn.

      I have various parameters passed trough each workItem and they are serialized using JPA.

      At some point I need to restart my workflow by reloading the session and calling the completeWorkItem method with the workItem id (line 06).

      For the moment before making my workItem asynchronous, I store the parameter map in a BLOB in db.

      At the time of restarting my workflow I load the BLOB content (line 04) and pass it as a result to the completeWorkItem method.

       

      As the workItem parameters are stored by JBPM, I would like to get rid of my BLOB because it makes my migrations sometimes difficult.

      How can I avoid storing and retrieving the parameters by myself?

       

      Thank you

       

      To be more specific, here is a code snippet for the workflow continuation:

       

      final SerializedWorkflow sw = this.serializedWorkflowRepository.findOne(serializedWorkflow.getId());
      StatefulKnowledgeSession ksession = this.knowlegBaseFactory.loadStatefulKSession(sw);
      
      final Map<String, Object> params = (Map<String, Object>) sw.getParamsAsObject();
      
      ksession.getWorkItemManager().completeWorkItem(sw.getWorkId(), params);