Rudi Fisher [
https://community.jboss.org/people/rudi_fisher] created the discussion
"signal event doesn't work from REST API"
To view the discussion, visit:
https://community.jboss.org/message/649256#649256
--------------------------------------------------------------
I want to use REST API to call signal. There is some implementation in ProcessMgmtFacade
of gwt-console-server for this. I see the source code and I finelly found this in
CommandDelegate of jbpm-gwt-core:
public void signalExecution(String executionId, String signal) {
ksession.getProcessInstance(new Long(executionId)).signalEvent("signal",
signal);
}
This doesn't fulfil my requirements so I made changes to this class recompile and
redeploy. This step is OK, because I made some other changes about this REST API (start
process with params) and everythings work fins, so I think the problem is not in this my
changed implementation of CommandDelegate. New implementation is:
public void signalExecution(String executionId, String eventType, String eventValue) {
ksession.getProcessInstance(new Long(executionId)).signalEvent(eventType, eventValue);
}
I took example of signal event from original examples to be sure that process is designed
OK. I took BPMN2-EventBasedSplit.bpmn2. I tested in Eclipse and works fine - after signal
call, process cointinued and finally finished. I deployed this process into my Guvnor repo
and started by GWT console. Process stopped and waits at signal nodes (see attached
picture).
https://community.jboss.org/servlet/JiveServlet/showImage/2-649256-17846/...
https://community.jboss.org/servlet/JiveServlet/downloadImage/2-649256-17...
At this point I wanted to push process by send signal event by REST API with new
implementation. Method signalExecution in CommandDelegate is called OK and this method
take correct process instance (I have log line there to see process instance). But it
seems signalEvent on process instance doesn't work. I'm using the same parameters
for signal event in Eclipse and in CommandDelegate. I'm confused about what is
different between execution in unit test in Eclipse and at server. I made many tests and
examples but my probem has no solution to this day. I found some discussion about similar
issues but this not solve this problem.
Working unit test in Eclipse
public static final void main(String[] args) throws Exception {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
System.out.println("process instance:" + processInstance.getState());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
System.out.println("process instance:" +
ksession.getProcessInstance(processInstance.getId()));
// NO
processInstance = ksession.startProcess("com.sample.test");
System.out.println("process instance:" + processInstance.getState());
//ksession = restoreSession(ksession, true);
ksession.signalEvent("No", "NoValue", processInstance.getId());
System.out.println("process instance:" +
ksession.getProcessInstance(processInstance.getId()));
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("BPMN2-EventBasedSplit.bpmn2"),
ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
Not working code in CommandDelegate and calling at GWT server
ksession.getProcessInstance(new Long(executionId)).signalEvent("Yes",
"YesValue");
For BPMN2-EventBasedSplit.bpmn2 see official examples in version 5.2.0 Final
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/649256#649256]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]