Hi,
I doing it the same way but not directly. I am not registering my handler with kession. But the completeWorkItem(workItemId, result) i am calling on the same session. The call to this method is not inside the handler but inside an ejb that is called from the new thread that i am calling.
My workItemHandler is as follows:
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
final String operation = (String) workItem.getParameter("Operation");
final WorkItem internalWorkItem = workItem;
final WorkItemManager internalWorkItemManager = manager;
new Thread(new Runnable()
{
public void run()
{
Map<String, Object> inParams = internalWorkItem.getParameters();
inParams.put("workItemId",Long.valueOf(internalWorkItem.getId()));
inputParams.add((Serializable)inParams);
try
{
results = EJBCallLookUP.call(operation, inputParams);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}).start();
}
in the EJBCallLookUP.call I am looking up the ejb for the operation and calling the method with operation name. Inside that operation i am calling the completeWorkItem(...) with the session.