[jboss-user] [jBPM] - CommandBasedWSHumanTaskHandler session, client ???

Gary Struthers do-not-reply at jboss.com
Sun Aug 14 19:06:33 EDT 2011

Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion

"CommandBasedWSHumanTaskHandler session, client ???"

To view the discussion, visit: http://community.jboss.org/message/620982#620982

To persist a session, I'm trying to use CommandBasedWSHumanTaskHandler in code based on Salaboy's PersistentProcessManager and TaskClientHelper with Mina

private StatefulKnowledgeSession getKnowledgeSession() {
        StatefulKnowledgeSession ksession = null;
if (ksessionId == null) {

            ksession = JPAKnowledgeService.newStatefulKnowledgeSession(

ksessionId = ksession.getId();
        } else {
            ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(

humanActivitiesHandler = new CommandBasedWSHumanTaskHandler(ksession);
            this.workItemsHandlers.put("Human Task", humanActivitiesHandler);

for (Map.Entry<String, WorkItemHandler> entry : this.workItemsHandlers.entrySet()) {
            ksession.getWorkItemManager().registerWorkItemHandler(entry.getKey(), entry.getValue());

        //Configures a logger for the session

return ksession;

The handler only accepts a session in the constructor so I guess I'm supposed to construct one every time I get a session from the database and then hope resisterWorkItem works correctly. This doesn't look good. I wish I could create the handler once and then bind it to a session when I have one. I don't know if creating these handlers is idempotent. Then I tried exposing the TaskClient and passing it to the new handler.

Inside the handler the connect method creates a WSHumanTaskHandler. This looks like a bug.  
public class CommandBasedWSHumanTaskHandler implements WorkItemHandler {
public void connect() {
if (client == null) {
client = new TaskClient(new MinaTaskClientConnector("org.drools.process.workitem.wsht.WSHumanTaskHandler", 
new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
boolean connected = client.connect(ipAddress, port);

if (!connected) {
throw new IllegalArgumentException("Could not connect task client");

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110814/a75f8539/attachment-0001.html 

More information about the jboss-user mailing list