# Execution does not have a subscription to a message event

**URL:** <https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111>\
**Category:** Flowable Engine\
**Created:** [November 24, 2016, 4:09am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111 "2016-11-24T04:09:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernelogic](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kernelogic/32/49_2.png) [@kernelogic](https://forum.flowable.org/u/kernelogic)\
**Post date:** [November 24, 2016, 4:09am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/1 "2016-11-24T04:09:15Z")

</div>

Hello, I am having trouble with message event. When a message event called “reject” is fired, the process supposes to cancel any current task inside the subprocess and go back to the first one. It was working before, until I changed all the user tasks inside the subprocess to be multi-instance. I am getting the following error.

Does anyone experienced similar behavior with multi-instance user task?

org.activiti.engine.ActivitiException: Execution with id ‘147794’ does not have a subscription to a message event with name ‘reject’  
at org.activiti.engine.impl.cmd.MessageEventReceivedCmd.execute(MessageEventReceivedCmd.java:76) ~[flowable-engine-5.22.0.jar:5.22.0]  
at org.activiti.engine.impl.cmd.MessageEventReceivedCmd.execute(MessageEventReceivedCmd.java:33) ~[flowable-engine-5.22.0.jar:5.22.0]  
at org.activiti.engine.impl.cmd.NeedsActiveExecutionCmd.execute(NeedsActiveExecutionCmd.java:55) ~[flowable-engine-5.22.0.jar:5.22.0]  
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) ~[flowable-engine-5.22.0.jar:5.22.0]  
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) ~[flowable-engine-5.22.0.jar:5.22.0]  
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) ~[flowable-spring-5.22.0.jar:5.22.0]  
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.3.3.RELEASE.jar:4.3.3.RELEASE]  
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) ~[flowable-spring-5.22.0.jar:5.22.0]

![](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/f17ba99c9ea0da9a9fe10e402a2dee8940d1009f.png)

---

<div class="post-metadata">

**Author:** ![kernelogic](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kernelogic/32/49_2.png) [@kernelogic](https://forum.flowable.org/u/kernelogic)\
**Post date:** [November 24, 2016, 4:10am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/2 "2016-11-24T04:10:46Z")

</div>

Here is the process definition.

![](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/35a9c76ab50b6659f052b43067f4aaf5e4511c55.png)

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [November 24, 2016, 11:41am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/3 "2016-11-24T11:41:46Z")

</div>

Hi,

Which execution id are you using for the message event?  
Because you changed to multi instance tasks, there will be multiple executions active for the process instance and therefore it’s important that the correct execution id of the embedded sub process is used.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![kernelogic](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kernelogic/32/49_2.png) [@kernelogic](https://forum.flowable.org/u/kernelogic)\
**Post date:** [November 24, 2016, 2:47pm UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/4 "2016-11-24T14:47:36Z")

</div>

Hi Tijs, I am submiting the message to the current active task’s execution id. so you are saying i should submit it to the subprocess’ execution id instead?

How do I get the subprocess execution id from task?

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [November 24, 2016, 3:05pm UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/5 "2016-11-24T15:05:57Z")

</div>

Hi,

Yes indeed. You need the execution id of the message subscription which is on a different scope execution.  
You can retrieve the correct execution with the ExecutionQuery on RuntimeService and use the messageEventSubscriptionName and processInstanceId.

Best regards,

Tijs

---

<div class="post-metadata">

**Author:** ![kernelogic](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/kernelogic/32/49_2.png) [@kernelogic](https://forum.flowable.org/u/kernelogic)\
**Post date:** [November 24, 2016, 11:45pm UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/6 "2016-11-24T23:45:15Z")

</div>

Thanks, this does work!

`runtimeService.createExecutionQuery().processInstanceId(processInstanceId).messageEventSubscriptionName("reject").singleResult();`

---

<div class="post-metadata">

**Author:** ![JS\_CHAN](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@JS\_CHAN](https://forum.flowable.org/u/JS_CHAN)\
**Post date:** [July 15, 2020, 1:25am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/8 "2020-07-15T01:25:09Z")

</div>

Hi @kernelogic,

~~I~~~~ had ~~~~met~~~~ the ~~~~same~~~~ issue ~~,~~ could ~~~~you~~~~ please ~~~~show~~~~ me ~~~~the~~~~ BPMN ~~~~file~~~~? ~~~~ How ~~~~to~~~~ subscribe ~~~~a~~~~ message ~~~~event~~~~?~~

---

<div class="post-metadata">

**Author:** ![SankhaJay](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sankhajay/32/2219_2.png) [@SankhaJay](https://forum.flowable.org/u/SankhaJay)\
**Post date:** [February 11, 2021, 2:40am UTC](https://forum.flowable.org/t/execution-does-not-have-a-subscription-to-a-message-event/111/9 "2021-02-11T02:40:32Z")

</div>

addition to the previous answers.  
you can get the process instance by creating a runtimeService.createProcessInstanceQuery()  
in my case, I used the primary key of my process instance to get the specific process instance I wanted.

```
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().variableValueEquals("processVariableName", processVariableValue).singleResult();
```
