[jboss-user] [jBPM] - Re: How to make a process instance go on with jBPM5?
Sebastien Lelarge
do-not-reply at jboss.com
Thu Oct 20 11:04:11 EDT 2011
Sebastien Lelarge [http://community.jboss.org/people/slelarge] created the discussion
"Re: How to make a process instance go on with jBPM5?"
To view the discussion, visit: http://community.jboss.org/message/632793#632793
--------------------------------------------------------------
Thank you for your answer Melih. I've tried this yesterday but it caused bad results and Transaction related exceptions when I tried to completeWorkItem from the method where I call the complete command with the TaskCient.
hopefully, I have just found the reason why my process instances refused to go on after session restore and I will share this below.
Now things seems to be going well after restarts
It is possible that some users are in the same situation.
In mine, the jBPM engine is embedded in a web application and the Human Task server is started from a dedicated servlet (as suggested by bpmn2user in another post) that launches it as a separate thread.
On the other side, the jBPM engine is initialized (knowledge base and session creation) at application startup in a ServletContextListener.
What I didn't realize at this time is that the Human Task server is not yet started when I register the "Human Task" worktitem with the ksession...
It seems (but I am not sure) that the *register command tries to contact the HT server but logs nothing whatever connection result.*
In the case where the HT server is not available, then the WorkItemHandler cannot wake up the persisted workitems correctly. Particularly, when I tried to complete a task, the Task Server returned a "No listeners found" message telling that it didn't have signals to send back to the workflow engine.
Now that I know that, I have rewritten my HumanTask Server servlet in order to proceed to WorkItem registration after the server is correctly started.
And things are working without manually completing workItem when completing tasks
Here is a snippet of my start HT server servlet
logger.info("Starting jBPM Human Task Server...");
taskServerDaemon.startServer(this.port);
logger.info("jBPM Human Task Server started.");
// Get the Knowledge Session initialized at application startup from app context
// and register Human Task WorkItem
logger.info("Registering Human Task Service for jBPM session.");
StatefulKnowledgeSession ksession = (StatefulKnowledgeSession)this.getServletContext().getAttribute(ksessionAttribute);
if (ksession == null) {
logger.error("The retrieved ksession is null. Cannot continue");
} else {
CommandBasedWSHumanTaskHandler wsht = new CommandBasedWSHumanTaskHandler(ksession);
try {
hostname = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException uhe) {
logger.error("Unable to resolve local host IP");
}
wsht.setConnection(this.hostname, this.port);
wsht.connect();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wsht);
logger.info("Human Task Service for jBPM session " + ksession.getId() + " is registered");
}
I hope this can help
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/632793#632793]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111020/fa2f6d3a/attachment.html
More information about the jboss-user
mailing list