AnsweredAssumed Answered

How to signal ReceiveTask externally?

Question asked by monika_b on Dec 6, 2013
Latest reply on Dec 6, 2013 by frederikheremans1
Mine is standalone Java Application and my use case is: To have a receive task (waiting to be triggered from outside later) After it gets runtimeService.signal(waitExecutionId), it should proceed further else should persist this state indefinately.

I have selected 'receive task' for this and trying to signal this from another workflow whose service task has below code to trigger the receive task. In below code, I am fetching waiting receive task process instanceId via process variable that gets set through listener configured in receivetask.

public class JavaServiceSignal implements JavaDelegate
   public void execute(DelegateExecution execution) throws Exception {
      List<HistoricVariableInstance> hvi = historyService.createHistoricVariableInstanceQuery().variableValueEquals("rcvwait", "true").orderByProcessInstanceId().desc().list();
      String waitProcessInstanceIdString = hvi.get(0).getProcessInstanceId();
      Execution execution1 = runtimeService.createExecutionQuery().processInstanceId(waitProcessInstanceIdString).activityId("receivetask1").singleResult();
      System.out.println("Wait Completed");      

Basically In main method(standalone java application), I have first deployed a workflow with receivetask. Then again deployed another workflow that basically triggers the receive task in 1st workflow by above code through its servicetask.
Code in main method below:

      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("waitReceiveProcess");      
      System.out.println("Main: Started wait for Message Process instance id " + processInstance.getProcessInstanceId());      
      ProcessInstance pi2 = runtimeService.startProcessInstanceByKey("signalWaitReceiveProcess");

I am getting error as <b>org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'receiveTask'</b>

Please help..