Caused by: org.flowable.common.engine.api.FlowableException: Execution with id ‘PRC-ffb6f7bd-1560-11f0-9c93-e2a237908fae’ does not have a subscription to a message event with name <message_name>

I’m facing an issue with starting a Flowable process programmatically when receiving a JMS message via a JobHandler. Here’s the flow I am implementing:

ProcessInstance ex = CommandContextUtil
                        .getProcessEngineConfiguration(commandContext)
                        .getRuntimeService()
                        .startProcessInstanceByKey(config.getProcessDefinitionKey(), config.getVariables());

However, this doesn’t seem to start the process as expected. Instead, I get the following error:

org.flowable.common.engine.api.FlowableException: Error sending message event
Caused by: org.flowable.common.engine.api.FlowableException: Execution with id 'PRC-ffb6f7bd-1560-11f0-9c93-e2a237908fae' does not have a subscription to a message event with name <message_name>

When I manually start the process via an endpoint like this:

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
    model.getProcessDefinitionKey(), model.getVariables());

The process starts successfully, and the subscriptions for message events are added. After that, when the message event is received, it gets processed properly. However, when starting the process programmatically upon receiving the JMS message, the process doesn’t appear to subscribe to the message events, and I get the error mentioned above.

Environment:

  • Java Version: 17
  • Flowable Version: 6.8.1
  • Spring Version: 2.6.6

Hey @yashodharanawaka,

Why are you using a JobHandler to send out a message? Can you perhaps create an example that we can try out?

Cheers,
Filip

Hi @filiphr,

Let me explain my implementation.

I have a JMS listener that listens to a specific topic. Upon receiving a JMS event, I create a new command which implements

org.flowable.common.engine.impl.interceptor.Command

and executes it.

During the execution of this command, a job of type JOB_TYPE_MESSAGE is scheduled. This job is handled by a job handler that implements org.flowable.job.service.JobHandler.

During the job handler’s execution, it runs the following code:

ProcessInstance ex = CommandContextUtil
    .getProcessEngineConfiguration(commandContext)
    .getRuntimeService()
    .startProcessInstanceByKey(config.getProcessDefinitionKey(), config.getVariables());

Hey @yashodharanawaka,

The interface you are implementing is not part of the public API. In order for us to be able to help you more we would need a Minimal Reproducible example. Can you please create a small project and share it with us. This way we can run exactly what you are doing and we can see what the root cause of the problem is.

Cheers,
Filip