AnsweredAssumed Answered

Execution query by messageEventSubscriptionName question

Question asked by andy135790 on Dec 8, 2014
Latest reply on Dec 8, 2014 by andy135790
Hi,

I have only one process instance running that has a boundary message event "testMessage" and a local variable "customerId" set to "1".

The definition look something like this:

<message id="testMessage" name="testMessage"></message>
<process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="User Task1"></userTask>
    <sequenceFlow id="flow2" sourceRef="scripttask1" targetRef="usertask1"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>execution.setVariable("customerId", "1")</script>
    </scriptTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
    <boundaryEvent id="message" name="testMessage" attachedToRef="usertask1" cancelActivity="true">
      <messageEventDefinition messageRef="testMessage"></messageEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flow3" sourceRef="message" targetRef="endevent2"></sequenceFlow>
</process>

But I got null when I try to query this execution.

runtimeService.createExecutionQuery().messageEventSubscriptionName("testMessage").variableValueEqualsIgnoreCase("customerId", "1").singleResult()
This should work according to the user guide

Also I got different id when I try to query them separately.

def id1 = runtimeService.createExecutionQuery().messageEventSubscriptionName("testMessage").singleResult().id
def id2 = runtimeService.createExecutionQuery().variableValueEquals("customerId", "1").singleResult().id
assert id1 != id2

Anyone knows why is that?

Thanks in advance.

Outcomes