AnsweredAssumed Answered

sending specific signal to custom behavior task

Question asked by miran on Apr 18, 2016
Latest reply on Apr 21, 2016 by rajivmoghe
Hi, I got following problem - I use custom behavior to do some async work and I need to notify the process instance with information how the async task ended  - I am using following code:

public class MyAsyncTask implements SignallableActivityBehavior {

    // something that takes long time (sending JMS message) 
    public void execute(ActivityExecution exec) throws Exception {
        // sending msg to JMS here, long running task …
    }

    // after processing JMS, queue the process is notified and this method is invoked:
    public void signal(ActivityExecution execution, String signalEvent,
                       Object signalData) throws Exception {
        PvmTransition transition = execution.getActivity().getOutgoingTransitions().get(0);
        execution.take(transition);
    }

}

  and to notify the process I use


runtimeService.signal(pid); // working ok …


I found this solution here: https://forums.activiti.org/content/suspending-process-instance and it works for me except for that I need to send to the process also information about how the long running task ended - in other words, I need to send also event name and some data; if I use method

runtimeService.signalEventReceived(eventName, pid, vars);

I got following error:

Exception in thread "main" org.activiti.engine.ActivitiException: Execution '15001' has not subscribed to a signal event with name 'Failure Local'.


I found this (or similar) issue several times on activiti forums, but without satisfying answer.

Is this somehow doable with activiti? Do I need to invoke some method to subscribe the process instance to the event or do I need to model something specific in the process?

Thanks in advance!

Outcomes