Signal Data is null in ReceiveTaskActivityBehavior
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 02:14 AM
I have simple process with a Service Task backed by a ReceiveTaskActivityBehavior. It will invoke a command in a remote machine and wait for a notification. When I send a signal from outside, it hits the signal method but the data is null. Please help.
test.bpmn
———–
ReceiveTaskActivityBehavior
————————
Command.java
————-
test.bpmn
———–
<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> <process id="test1" name="test1" isExecutable="true"> <startEvent id="startevent1" name="Start"></startEvent> <endEvent id="endevent1" name="End"></endEvent> <serviceTask id="servicetask1" name="Service Task" activiti:class="org.activiti.CustomTask"></serviceTask> <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow> <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow> </process> </definitions>
ReceiveTaskActivityBehavior
————————
public class CustomTask extends ReceiveTaskActivityBehavior { private static final long serialVersionUID = 2945313111593357836L; /* * (non-Javadoc) * * @see * org.activiti.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior#execute * (org.activiti.engine.impl.pvm.delegate.ActivityExecution) */ @Override public void execute(ActivityExecution execution) throws Exception { Command command = new Command(); command.doSomething(execution.getEngineServices().getRuntimeService(), execution); } /* * (non-Javadoc) * * @see * org.activiti.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior#signal * (org.activiti.engine.impl.pvm.delegate.ActivityExecution, * java.lang.String, java.lang.Object) */ @Override public void signal(ActivityExecution execution, String signalName, Object data) throws Exception { //Fails here Assert.assertEquals(data != null, true); leave(execution); }}
Command.java
————-
public class Command { public void doSomething(RuntimeService runtimeService, ActivityExecution execution) { System.out.println("done"); //notify Map<String, Object> signalData = new HashMap<String, Object>(); runtimeService.signal(execution.getId(), signalData); }}
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 06:06 AM
The signalData is stored as process variables on the execution, it's not the signal data object. So you can get the Map content with the execution getVariable method based on the map key.
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2015 12:16 PM
Thanks. I verified its set in the process variables. But the signalData parameter was confusing.
