cancel
Showing results for 
Search instead for 
Did you mean: 

execution query with signalEventSubscriptionName does not work with other criteria

pcuvecle_9059
Champ in-the-making
Champ in-the-making
Hi All,

If I run this :

List<Execution> executions = runtimeService.createExecutionQuery()
   .signalEventSubscriptionName(signalName)
   .list();

I get all the executions waiting for signaName

But if I add another criteria like processInstanceId, I would expect to have the execution waiting for signalName but only for process having instance ID = processInstanceId


List<Execution> executions = runtimeService.createExecutionQuery()
   .signalEventSubscriptionName(signalName)
   .processInstanceId(processInstanceId)
   .list();


But I get no result (of course in my test I had a waiting signal in the process instance I used)
It seams that if I put any other criteria than signalEventSubscriptionName in the execution query, I get no result in all cases.
This applies to V5.14.



6 REPLIES 6

trademak
Star Contributor
Star Contributor
Could you create a unit test and a JIRA so we can reproduce it?

Thanks,

pcuvecle_9059
Champ in-the-making
Champ in-the-making
In fact this is when I use this query
<java>
List<Execution> executions = runtimeService.createExecutionQuery()
.signalEventSubscriptionName("mySignal")
.processInstanceBusinessKey("MY-BUSINESS-KEY")
.processDefinitionKey("simpleSignalCatch")
.list();
</java>
that the execution list is empty (when processInstanceBusinessKey is added)

I have open http://jira.codehaus.org/browse/ACT-1932

billdoor
Champ in-the-making
Champ in-the-making
Is this resolved? I am running activiti 5.17.0

<code>
        Execution execution_0 = activitiRule.getRuntimeService().createExecutionQuery()
                .signalEventSubscriptionName("startSignal")
                .singleResult();
</code>
this returns a "ScopeExecution" (intelliJ Debugger)

<code>
        Execution execution_1 = activitiRule.getRuntimeService().createExecutionQuery()
                .processDefinitionKey("test_process")
                .processInstanceBusinessKey("a1")
                .singleResult();
</code>
this returns an Execution


<code>
        Execution execution_2 = activitiRule.getRuntimeService().createExecutionQuery()
                .signalEventSubscriptionName("startSignal")
                .processDefinitionKey("test_process")
                .processInstanceBusinessKey("a1")
                .singleResult();
</code>

this returns null.

jbarrez
Star Contributor
Star Contributor
That doesn't look right. Can you paste the relevant content of your ACT_RU_EXECUTION and ACT_RU_EVENT_SUBSCR tables?

billdoor
Champ in-the-making
Champ in-the-making
My fault, it is correct, because the catching-event resides in a branch of a exclusive gateway and therefore is in a subexecution.

njames
Champ in-the-making
Champ in-the-making
If it helps any, we had the same problem. I wanted to find any process instances that are subscribed to a message and have a particular variable value. We have a process that has en embedded sub-process which listening for a particular message via a boundary message catch event. Of course, we have many instances of this process running at any given time, but each has a different value for a discriminator variable. From a different process we want to find the right sub process to send the message to, based on the value of the discriminator.
It seems like the query that gets generated is trying to join an execution (from the sub process' subscription) to a process instance (from the variable value). In this example, please excuse the Camel…

                .setProperty("processesWithVar").groovy("return exchange.context.registry.lookupByName('runtimeService').createExecutionQuery().variableValueEquals('messageDiscriminator', exchange.properties['discriminator']).list().collect({ex -> ex.processInstanceId})")
                .log("list of process ids with discriminator= '${property.processesWithVar}'")
                .setProperty("processesWithMessageSubscription").groovy("return exchange.context.registry.lookupByName('runtimeService').createExecutionQuery().messageEventSubscriptionName('someEvent').list().collect({ex -> ex.processInstanceId})")
                .log("list of process ids with subscription = '${property.processesWithMessageSubscription}'")
                .setProperty("processIdList").groovy("return exchange.properties['processesWithMessageSubscription'].intersect(exchange.properties['processesWithVar'])")
                .log("(intersection) property processIdList = '${property.processIdList}'")
Realizing this, I did two separate queries and found the intersection using Groovy. It's Groovy, but would be even groovier if I could use one compound query.

                .setProperty("processIdList").groovy("return exchange.context.registry.lookupByName('runtimeService').createExecutionQuery().messageEventSubscriptionName('someEvent').variableValueEquals('messageDiscriminator', exchange.properties['discriminator']).list().collect({ex -> ex.processInstanceId})")
Unfortunately, the join goes badly and I always get an empty list.
Same?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.