JBoss Community

How to access a processInstance within a work item

created by Tobias Wittur in jBPM - View the full discussion

Hello,

 

I know usually a signal is invoked upon the knowledgeSession, and all processInstances that are registered on this session and listen to the messageType, will be notified. E.g.

ksession.signalEvent("Message-StartProcessMessage", params);

 

However, how can I signal a specific process instance from within a work Item?

 

I know how to get to the ProcessInstanceId, but how would I have to go on?

 

public class CustomerServiceTaskHandler implements WorkItemHandler {

 

    public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

       System.out.println(workItem.getProcessInstanceId());

 

          try{

...

          }catch(Exception ex){

              myProcessInstance.signal('AbortTheCurrentInstance');

          }

      

    }

 

    public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {

    }

}

 

 

Best regards,

 

Tobias

Reply to this message by going to Community

Start a new discussion in jBPM at Community