jbpm process REST api for signaling process does not work (is it a bug?)
marmotadev Mar 27, 2012 2:22 PMHello,
I can sucessfully invoke REST api for starting service, however invoking /rs/process/tokens/<process instance id>/transition?signal=<signal name> does not send signals to process engine.
If I run process locally (in eclipse):
kcontext.getKnowledgeRuntime().signalEvent( eventType, data, kcontext.getProcessInstance().getId());
- all signals reach nodes inside the process. Event/Signal nodes are configured as "external".
Here are logs for invoking HTTP requests:
DEBUG org.apache.http.impl.conn.DefaultClientConnection - Sending request: POST /gwt-console-server/rs/process/tokens/5/transition?signal=RODataReceivedSignal HTTP/1.1
DEBUG org.apache.http.wire - >> "POST /gwt-console-server/rs/process/tokens/5/transition?signal=RODataReceivedSignal HTTP/1.1[\r][\n]"
DEBUG org.apache.http.wire - >> "JSESSIONID: XRW3Gp28tTUF2NLekPsm10e6[\r][\n]"
DEBUG org.apache.http.wire - >> "Content-Length: 0[\r][\n]"
DEBUG org.apache.http.wire - >> "Content-Type: application/x-www-form-urlencoded; charset=UTF-8[\r][\n]"
DEBUG org.apache.http.wire - >> "Host: localhost:8080[\r][\n]"
DEBUG org.apache.http.wire - >> "Connection: Keep-Alive[\r][\n]"
DEBUG org.apache.http.wire - >> "User-Agent: Apache-HttpClient/4.1.3 (java 1.5)[\r][\n]"
DEBUG org.apache.http.wire - >> "Cookie: JSESSIONID=XRW3Gp28tTUF2NLekPsm10e6[\r][\n]"
DEBUG org.apache.http.wire - >> "Cookie2: $Version=1[\r][\n]"
DEBUG org.apache.http.wire - >> "[\r][\n]"
DEBUG org.apache.http.headers - >> POST /gwt-console-server/rs/process/tokens/5/transition?signal=RODataReceivedSignal HTTP/1.1
DEBUG org.apache.http.headers - >> JSESSIONID: XRW3Gp28tTUF2NLekPsm10e6
DEBUG org.apache.http.headers - >> Content-Length: 0
DEBUG org.apache.http.headers - >> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
DEBUG org.apache.http.headers - >> Host: localhost:8080
DEBUG org.apache.http.headers - >> Connection: Keep-Alive
DEBUG org.apache.http.headers - >> User-Agent: Apache-HttpClient/4.1.3 (java 1.5)
DEBUG org.apache.http.headers - >> Cookie: JSESSIONID=XRW3Gp28tTUF2NLekPsm10e6
DEBUG org.apache.http.headers - >> Cookie2: $Version=1
DEBUG org.apache.http.wire - << "HTTP/1.1 200 OK[\r][\n]"
DEBUG org.apache.http.wire - << "Server: Apache-Coyote/1.1[\r][\n]"
DEBUG org.apache.http.wire - << "Content-Type: application/json[\r][\n]"
DEBUG org.apache.http.wire - << "Transfer-Encoding: chunked[\r][\n]"
DEBUG org.apache.http.wire - << "Date: Tue, 27 Mar 2012 18:18:20 GMT[\r][\n]"
DEBUG org.apache.http.wire - << "[\r][\n]"
DEBUG org.apache.http.impl.conn.DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
DEBUG org.apache.http.headers - << Server: Apache-Coyote/1.1
DEBUG org.apache.http.headers - << Content-Type: application/json
DEBUG org.apache.http.headers - << Transfer-Encoding: chunked
DEBUG org.apache.http.headers - << Date: Tue, 27 Mar 2012 18:18:20 GMT
DEBUG org.apache.http.impl.client.DefaultHttpClient - Connection can be kept alive indefinitely
DEBUG org.apache.http.wire - << "0[\r][\n]"
DEBUG org.apache.http.wire - << "[\r][\n]"
if I look /gwt-console-server/rs/process/definition/<my process id>/instances, i can see that they are not "signalable":
{"instances":[{"id":"1","definitionId":"<process id>","startDate":"2012-03-27 20:31:13","suspended":false,"rootToken":{"id":"1","name":"","currentNodeName":"","children":[],"availableSignals":[],"canBeSignaled":false}}}]} |
But they have 3 signals defined inside process:
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<itemDefinition id="_inputSignalNameItem" structureRef="String" />
<process processType="Private" isExecutable="true" id="<my process id>" name="Signal catch process" tns:packageName="defaultPackage" >
<!-- process variables -->
<property id="inputSignalName" itemSubjectRef="_inputSignalNameItem"/>
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<intermediateCatchEvent id="_2" name="Signal" >
<dataOutput id="_2_Output" name="event" />
<dataOutputAssociation>
<sourceRef>_2_Output</sourceRef>
<targetRef>inputSignalName</targetRef>
</dataOutputAssociation>
<outputSet>
<dataOutputRefs>_2_Output</dataOutputRefs>
</outputSet>
<signalEventDefinition signalRef="RODataRepeatedSignal"/>
</intermediateCatchEvent>
<scriptTask id="_3" name="Script" scriptFormat="http://www.java.com/java" >
<script>System.out.println("TEST_SIGNAL");</script>
</scriptTask>
<endEvent id="_4" name="End" >
<terminateEventDefinition/>
</endEvent>
<parallelGateway id="_5" name="Gateway" gatewayDirection="Diverging" />
<intermediateCatchEvent id="_6" name="Signal" >
<dataOutput id="_6_Output" name="event" />
<dataOutputAssociation>
<sourceRef>_6_Output</sourceRef>
<targetRef>inputSignalName</targetRef>
</dataOutputAssociation>
<outputSet>
<dataOutputRefs>_6_Output</dataOutputRefs>
</outputSet>
<signalEventDefinition signalRef="OTHER_EVENT"/>
</intermediateCatchEvent>
<scriptTask id="_7" name="Script" >
<script>System.out.println("OTHER_SIGNAL");</script>
</scriptTask>
<exclusiveGateway id="_8" name="Gateway" gatewayDirection="Converging" />
<intermediateCatchEvent id="_9" name="Signal" >
<dataOutput id="_9_Output" name="event" />
<dataOutputAssociation>
<sourceRef>_9_Output</sourceRef>
<targetRef>inputSignalName</targetRef>
</dataOutputAssociation>
<outputSet>
<dataOutputRefs>_9_Output</dataOutputRefs>
</outputSet>
<signalEventDefinition signalRef="RODataReceivedSignal"/>
</intermediateCatchEvent>
<scriptTask id="_10" name="Script" scriptFormat="http://www.java.com/java" >
<script>System.out.println("BEFORE FIRST EVENT");</script>
</scriptTask>
<scriptTask id="_11" name="Script" scriptFormat="http://www.java.com/java" >
<script>System.out.println("AFTER FIRST EVENT");</script>
</scriptTask>
<!-- connections -->
<sequenceFlow id="_5-_2" sourceRef="_5" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
<sequenceFlow id="_8-_4" sourceRef="_8" targetRef="_4" />
<sequenceFlow id="_11-_5" sourceRef="_11" targetRef="_5" />
<sequenceFlow id="_5-_6" sourceRef="_5" targetRef="_6" />
<sequenceFlow id="_6-_7" sourceRef="_6" targetRef="_7" />
<sequenceFlow id="_3-_8" sourceRef="_3" targetRef="_8" />
<sequenceFlow id="_7-_8" sourceRef="_7" targetRef="_8" />
<sequenceFlow id="_10-_9" sourceRef="_10" targetRef="_9" />
<sequenceFlow id="_1-_10" sourceRef="_1" targetRef="_10" />
<sequenceFlow id="_9-_11" sourceRef="_9" targetRef="_11" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="<my process id>" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="16" y="56" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="481" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="561" y="16" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_4" >
<dc:Bounds x="754" y="56" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_5" >
<dc:Bounds x="400" y="56" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_6" >
<dc:Bounds x="481" y="96" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_7" >
<dc:Bounds x="561" y="96" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_8" >
<dc:Bounds x="673" y="56" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_9" >
<dc:Bounds x="208" y="56" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_10" >
<dc:Bounds x="96" y="56" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_11" >
<dc:Bounds x="288" y="56" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_5-_2" >
<di:waypoint x="424" y="80" />
<di:waypoint x="505" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="505" y="40" />
<di:waypoint x="601" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_8-_4" >
<di:waypoint x="697" y="80" />
<di:waypoint x="778" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_11-_5" >
<di:waypoint x="328" y="80" />
<di:waypoint x="424" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_5-_6" >
<di:waypoint x="424" y="80" />
<di:waypoint x="505" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_6-_7" >
<di:waypoint x="505" y="120" />
<di:waypoint x="601" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_3-_8" >
<di:waypoint x="601" y="40" />
<di:waypoint x="697" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_7-_8" >
<di:waypoint x="601" y="120" />
<di:waypoint x="697" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_10-_9" >
<di:waypoint x="136" y="80" />
<di:waypoint x="232" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_1-_10" >
<di:waypoint x="40" y="80" />
<di:waypoint x="136" y="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_9-_11" >
<di:waypoint x="232" y="80" />
<di:waypoint x="328" y="80" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
I've started looking and gwt console code and....
org.jbpm.integration.console.ProcessManagement:65
result.add(Transform.processInstance(processInstance)); |
makes transformation, which basically omits canBeSignaled, availableSignals fields!
ProcessInstanceRef result = new ProcessInstanceRef( processInstance.getProcessInstanceId() + "", processInstance.getProcessId(), processInstance.getStart(), processInstance.getEnd(), false); TokenReference token = new TokenReference( processInstance.getProcessInstanceId() + "", null, ""); result.setRootToken(token); return result;
ProcessManagementTest also lacks any tests:
@Test @Ignore
public void testSignalExecution() {
// TODO implement
}
Of course, I am not sure if this is the cause of ignoring signals. By looking at signal code it seems that processes should be signaled, however I could not setup development environment for gwt-console-server to trace exact behaviour (s.
Can anyone share experience with signaling processes running on gwt-console-server (Or a way to setup a debuging environment for gwt-console-server on eclipse)?
P.S. Sorry for formatting