cancel
Showing results for 
Search instead for 
Did you mean: 

Query signals/messages attached to current task

jsalmon
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to query the signals/messages attached to the current active task in my workflow (I only have a single task active at any time). However, each task may have one or more signals attached to it.

How can I query those signals without knowing their names in advance?

I found a way to do this, but using a non-public API:


Task task = taskService.createTaskQuery().processInstanceBusinessKey(request.getRequestId()).active().singleResult();

CommandExecutor executor = ((ProcessEngineConfigurationImpl) ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration()).getCommandExecutor();

List<EventSubscriptionEntity> events = new EventSubscriptionQueryImpl(executor).processInstanceId(task.getProcessInstanceId()).list())


Is there any way I can do this with public API? I know about
ExecutionQuery.signalEventSubscriptionName()
, but that requires knowing the signal names beforehand.

Cheers,
Justin
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Justin,

I did not use this query yet,
but there is org.activiti.engine.test.api.nonpublic.EventSubscriptionQueryTest#testQueryByExecutionId (activitiId() method is there too)

Regards
Martin

jsalmon
Champ in-the-making
Champ in-the-making
Hi Martin,

Thanks a lot for your response. Yes, in fact it was that test case where I found the <code>EventSubscriptionQueryImpl</code>. Do you think it is likely to become public API in the future?

Cheers,
Justin

trademak
Star Contributor
Star Contributor
If you think this should be part of the public API, please create a JIRA issue and we'll look into it.

Thanks,