AnsweredAssumed Answered

ExeuctionQuery filtering with 'messageEventSubscription' and 'variableValueEquals' does not seem to work

Question asked by rallen1 on Mar 13, 2015
Latest reply on Apr 29, 2015 by rallen1
Hello,

I am having some trouble finding an execution listening for a message and filtering on a specific variable.

It is possible I am using the API incorrectly, but there seems to be an issue when I attempt to query executions for a specific messageEventSubscription and variableValueEquals.


      // Create a basic query on the intermediate message.
      ExecutionQuery query = runtimeService.createExecutionQuery()
            .processInstanceId(processInstance.getProcessInstanceId())
            .messageEventSubscriptionName(MESSAGE);

      // Prove a query is returned.
      Execution execution = query.singleResult();
      assertNotNull(execution);
      // Prove our global variable is in the execution and its value is what is expected.
      assertEquals(runtimeService.getVariable(execution.getId(), KEY), VALUE);
      
      // If more than one query were returned above, we should be able to refine further
      // using variableValuesEqual. For some reason variableValueEquals and ignoreCase is failing.
      Execution refinedExecution = query.variableValueEquals(KEY, VALUE).singleResult();
      // !!! Fails. !!!
      assertNotNull(refinedExecution);


I wrote a unit test demonstrating the issue with the unit test template. I wasn't able to register with jira (codehaus had a random server error when I verified my email), so I apologize if this is the wrong place to post this.

My pom.xml is using the versions that reflect my actual project:


      <dependency>
         <groupId>org.activiti</groupId>
         <artifactId>activiti-engine</artifactId>
         <version>5.17.0</version>
      </dependency>
      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <version>1.4.181</version>
         <scope>test</scope>
      </dependency>


I tried switching the H2 version to 1.3.168, but it did not seem to make a difference.

I attached the unit test as well as the only two files I changed from the template (besides the pom.xml).

Any help is greatly appreciated.

Thank you.

Outcomes