Hi,
I have process definition with startMessageEventDefinition (START_EVENT → SCRIPT_TASK → END)
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:flowable="http://flowable.org/bpmn"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.flowable.org/processdef">
<message id="newInvoice1" name="newInvoiceMessage1" />
<process id="event" name="event" isExecutable="true">
<startEvent id="start">
<messageEventDefinition
messageRef="newInvoice1" />
</startEvent>
<scriptTask id="generate-invoice-item"
name="generate-invoice-item" flowable:async="true"
scriptFormat="groovy">
<script>
println ' generate-invoice-item'+execution.getVariables()+" "+execution
</script>
</scriptTask>
<endEvent id="end">
</endEvent>
<sequenceFlow sourceRef="start" targetRef="generate-invoice-item" />
<sequenceFlow sourceRef="generate-invoice-item" targetRef="end" />
</process>
</definitions>
Now I deploy this process and starts like this:
runtimeService.startProcessInstanceByMessage("newInvoiceMessage1");
Everything works fine.
Now I deploy second version of these process (I changed messageId of event)
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:flowable="http://flowable.org/bpmn"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.flowable.org/processdef">
<message id="newInvoice2" name="newInvoiceMessage2" />
<process id="event" name="event"
isExecutable="true">
<startEvent id="start" >
<messageEventDefinition messageRef="newInvoice2" />
</startEvent>
<scriptTask id="generate-invoice-item" name="generate-invoice-item" flowable:async="true" scriptFormat="groovy" >
<script>
println ' generate-invoice-item'+execution.getVariables()+" "+execution
</script>
</scriptTask>
<endEvent id="end" >
</endEvent>
<sequenceFlow sourceRef="start" targetRef="generate-invoice-item" />
<sequenceFlow sourceRef="generate-invoice-item" targetRef="end" />
</process>
</definitions>
Now I can start process by
runtimeService.startProcessInstanceByMessage("newInvoiceMessage2");
but I also want to go back and test something on old version(newInvoiceMessage1). But I can’t I’m getting error
Exception in thread "main" org.flowable.common.engine.api.FlowableObjectNotFoundException: Cannot start process instance by message: no subscription to message with name 'newInvoiceMessage1' found.
at org.flowable.engine.impl.cmd.StartProcessInstanceByMessageCmd.execute(StartProcessInstanceByMessageCmd.java:81)
at org.flowable.engine.impl.cmd.StartProcessInstanceByMessageCmd.execute(StartProcessInstanceByMessageCmd.java:36)
at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:67)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:140)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:114)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:26)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:105)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.RuntimeServiceImpl.startProcessInstanceByMessage(RuntimeServiceImpl.java:568)
I tried to suspend new verions, but this dosen’t work
repositoryService.suspendProcessDefinitionById(newDefinition.getId());
This is error in Flowable or desired behaviour???