Execution has not subscribed to a signal event with name


when I try to cancel a user task by means of a signal boundary event I get the error message "Execution has not subscribed to a signal event with name ‘sigCancel’. Below is the test process.

Is it possible at all to interrupt a user task with a boundary signal event?

In a unit test (the one provided by Camunda test-project) I do the following after starting the process:

    // Given we create a new process instance
    ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
    // Then it should be active
    // And it should be the only instance
    // And there should exist just a single task within that process instance

    final String currentActivityId = rule.getRuntimeService().getActiveActivityIds(processInstance.getId()).get(0);

    // cancel task
    rule.getRuntimeService().signalEventReceived("sigCancel", processInstance.getId());

testProcess.bpmn (3.8 KB)

Thanks in advance,
Best regards,

Hi @xman-berlin,

to deliver a signal to a single execution then you need first to query for signal event subscription to get the correct execution Id.

Below is an example of a REST call to query for signal event subscription

then you can use the executionId from the result in your throwing signal call
rule.getRuntimeService().signalEventReceived("sigCancel", <EXECUTION_ID>);

activity A is a scope activity. Due to the boundary event, it defines a context in which events can be received. This context is valid for the lifetime of the activity instance. It therefore requires an extra execution.

1 Like

Hi @hassang ,

this helped.

        // cancel task
        final List<Execution> executions = runtimeService().createExecutionQuery().
        runtimeService().signalEventReceived("sigCancel", executions.get(0).getId());