# Suspended Process Definition Remains Subscribed to Event

**URL:** https://forum.flowable.org/t/suspended-process-definition-remains-subscribed-to-event/10645
**Category:** Flowable Engine
**Created:** [June 26, 2023, 8:30pm UTC](https://forum.flowable.org/t/suspended-process-definition-remains-subscribed-to-event/10645 "2023-06-26T20:30:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![chaserb](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/chaserb/32/3084_2.png) [@chaserb](https://forum.flowable.org/u/chaserb)
#### Post date: [June 26, 2023, 8:30pm UTC](https://forum.flowable.org/t/suspended-process-definition-remains-subscribed-to-event/10645/1 "2023-06-26T20:30:48Z")

</div>

I have a process definition with a element that is registered for some event. The event is declared in an Event Registry deployment and is expected to arrive from an inbound queue on a message broker. After suspending the process definition, I noticed it is still subscribed to that event. Then, when the event arrives from the message broker, the engine throws the following exception and the message is kicked back to an error queue:

> Caused by: org.flowable.common.engine.api.FlowableException: Cannot start process instance. Process definition Policy Decision (id = myId:1:99a1b846-12bf-11ee-b67c-1663856039b4) is suspended

My question is whether I am suspending the process definition correctly. Is it sufficient to simply suspend the process definition, or is there something else I need to do to cancel the subscription for future events?

Here are the details on what I’m doing…

Process Definition:

```auto
<definitions ... >
  <process id="myId" name="Policy Decision" isExecutable="true">
    <startEvent id="Start" name="Start" isInterrupting="true">
      <extensionElements>
        <flowable:eventType xmlns:flowable="http://flowable.org/bpmn"><![CDATA[someEvent]]></flowable:eventType>
        <flowable:eventOutParameter xmlns:flowable="http://flowable.org/bpmn" source="someEventVar" sourceType="integer" target="someProcessVar"/>
      </extensionElements>
    </startEvent>
    ...

```

Process Definition Suspension:

```auto
PUT /process-api/repository/process-definitions/myId:1:99a1b846-12bf-11ee-b67c-1663856039b4

{
    "action": "suspend",
    "includeProcessInstances": "true"
}

```

Subscription remains active after suspension:

```auto
select EVENT_TYPE_, PROC_DEF_ID_, ACTIVITY_ID_ from ACT_RU_EVENT_SUBSCR where EVENT_TYPE_ = 'someEvent'

EVENT_TYPE_: 'someEvent'
PROC_DEF_ID_: 'myId:1:99a1b846-12bf-11ee-b67c-1663856039b4'
ACTIVITY_ID_: 'Start'

```

---

<div class="post-metadata">

### Author: ![chaserb](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/chaserb/32/3084_2.png) [@chaserb](https://forum.flowable.org/u/chaserb)
#### Post date: [January 2, 2024, 5:00pm UTC](https://forum.flowable.org/t/suspended-process-definition-remains-subscribed-to-event/10645/2 "2024-01-02T17:00:05Z")

</div>

Perhaps this is a bug? I see it has been reported, but no acknowledgment yet:

> <https://github.com/flowable/flowable-engine/issues/3601>
>
> \*\*Describe the bug\*\*
> I have set up a process definition with a start event usin…g the event registry linked to a RabbitMQ channel.
> 
> Everything works as expected when sending a message to the RabbitMQ queue.
> 
> Afterwards, I suspend the process definition and I send a message to the RabbitMQ queue again.
> 
> The message receiver will try to start a process but fails to do so due to the process definition being suspended. The RabbitMQ message is then considered to be in error and is retried, creating an infinite loop.
> 
> \*\*Expected behavior\*\*
> I would expect starting a process from a suspended process definition id not to happen, or having the event subscription to no longer match the given process definition.
> 
> If there is any workaround for this, I would be happy to try this as well.
> 
> \*\*Additional context\*\*
> Using Flowable 6.8.0
> Using Flowable within Spring Boot
