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( kbase, null, env); ksessionId = ksession.getId(); } else { ksession = JPAKnowledgeService.loadStatefulKnowledgeSession( ksessionId, kbase, null, env); } humanActivitiesHandler = new CommandBasedWSHumanTaskHandler(ksession); humanActivitiesHandler.setClient(TaskClientHelper.getInstance().taskClient); 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 KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession); 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 [http://community.jboss.org/message/620982#620982] Start a new discussion in jBPM at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
