JBoss Community

jbpm process REST api for signaling process does not work (is it a bug?)

created by marmotadev in jBPM - View the full discussion

Hello,

 

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:

 

 

 

 

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)?

Reply to this message by going to Community

Start a new discussion in jBPM at Community