07-19-2017 04:47 AM
Hello,
I've read the following documentation regarding signaling an execution (in the user guide):
13.6.2. Execute an action on an execution
PUT runtime/executions/{executionId}
Table 90. Execute an action on an execution - URL parameters Parameter Required Value Description executionId
Yes
String
The id of the execution to execute action on.
Request body (signal an execution):
123{
"action":"signal"
}
The above request works, but it doesn't signal a specific receive task? I'm looking for something like:
1 2 3 4 | { "action":"signal", "receiveTaskId": "myReceiveTask" } |
I'm new to both activiti and BPMN, so if this question is regarded to bad understanding of CPMN principals, I would love a clarification.
Thanks in advance!
Aviran
07-20-2017 12:12 PM
Since signals and messages can be used in a variety of ways, the signaling a signal on a receive task cannot work as you mentioned by "receiveTaskId": "myReceiveTask".
Signals are generally used for broadcasting. If you are looking to send a signal to a particular receive task using a boundary event I suggest using a message event. For better readability, name the message event something like "receive-task-message-event" which makes it look tied to your receive task .
For completing the receive task it is a two step process, you will first need to query for active message subscriptions (executions) with name "receive-task-message-event" and get the execution id. Then complete the message subscription by executing the API
Hope this helps.
07-19-2017 05:02 PM
Anyone?
07-20-2017 12:12 PM
Since signals and messages can be used in a variety of ways, the signaling a signal on a receive task cannot work as you mentioned by "receiveTaskId": "myReceiveTask".
Signals are generally used for broadcasting. If you are looking to send a signal to a particular receive task using a boundary event I suggest using a message event. For better readability, name the message event something like "receive-task-message-event" which makes it look tied to your receive task .
For completing the receive task it is a two step process, you will first need to query for active message subscriptions (executions) with name "receive-task-message-event" and get the execution id. Then complete the message subscription by executing the API
Hope this helps.
07-25-2017 07:40 AM
Thank you for your answer. It helped indeed.
However, this triggered a different issue: we handle events from Activiti using an implementation of ActivitiEventListener. This works like a charm as process instances proceed from within Activiti Explorer or Activiti REST. But when I send a message via the API, events such as ACTIVITY_COMPLETED are not fired.
See the following code snippet:
public static void main(String[] args) {
readProperties();
processEngine = buildProcessEngine();
processEngine.getRuntimeService().addEventListener(new ActivitiEventHandler("localhost", "61616"));
new MessageSender(processEngine).sendMessage(args);
}
What am I missing here?
Aviran
07-25-2017 09:19 AM
In case anyone would come across the same problem -
This was a misunderstanding: I presumed that all events would show up in the ACT_EVT_LOG table, not knowing that there's a registered event listener that popoulates it. After not seeing the expected events in the table I thought that activiti doesn't dispatch them, when in reality they were dispatched but had no indication.
So I added the following line, which made activiti populate ACT_EVT_LOG:
runtimeService.addEventListener(new EventLogger(processEngine.getProcessEngineConfiguration().getClock()));
Explore our Alfresco products with the links below. Use labels to filter content by product module.