09-19-2016 08:51 PM
<message id="Task_Message" name="Task Message"/>
<receiveTask id="Receive_Balance_Message" name="Receive Balance Message" messageRef="Task_Message"/>
List<Execution> executions = runtimeService.createExecutionQuery().messageEventSubscriptionName("Task Message").list();
for (Execution execution : executions) {
runtimeService.messageEventReceived("Task Message", execution.getId()));
}
09-20-2016 05:38 AM
ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask");
Execution execution = runtimeService.createExecutionQuery()
.processInstanceId(pi.getId())
.activityId("waitState")
.singleResult();
assertNotNull(execution);
runtimeService.signal(execution.getId());
12-15-2016 09:06 AM
Hey Andrey,
Warper has provided a good technical explanation, but I wanted to add a little more "colour" to your questions below....
<snip>
Does Activiti 5.21 fully implement ReceiveTask functionality? What could be the reason that the message correlation is not established?
The user guide mentions "currently we have only implemented Java semantics for this task" but suggests messages can be received nevertheless. If that is still the case, could we expect message events are implemented in Activiti 6.0?
</snip>
Activiti (5 and 6) rely on a message framework injecting messages into the workflow engine. We have done this using message driven beans when running on a J2EE app server, or more easily using Camel or Mule.
The easiest way (IMO) to tie activiti into a JMS, ActiveMQ, email or other messaging system is to use the available camel (or mule) service tasks.
If you want to use the generic receive message, you will need to have a class "signal" the execution :
runtimeService.signal(execution.getId());
In order to let it proceed.
Hope this helps,
Greg
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.