Perhaps having this logic inside work item handler that can take this complexity - so you will have a custom work item handler implementation that acts like a wrapper for other work item handlers (service task human task, etc) and can perform exception handling if such a need arise. Wdyt?
thanks for your answer.
That would be my preferred approach. My only doubt is how would I perform the handling from this wrapper.
I've looked into the KnowledgeSessionAware interface solution that Kris suggested in other topic (https://community.jboss.org/thread/168600) and have this implemented in an embedded scenario, but I'm not sure how I'd implement this to work on processes initiated via the jbpm-console without having to fork jBPM code. Also Kris provided an implementation for a work item handler that is session aware (in https://github.com/droolsjbpm/jbpm/blob/master/jbpm-workitems/src/main/java/org/jbpm/process/workitem/AbstractWorkItemHandler.java#L40) but again I couldn't find any integration with a jbpm-console started process.
So is there any preferred approach for this? Is it possible, if we go the signaling route, by configuration, to switch the work item manager used by jbpm-console so that it passes the session to the handlers?
Thanks for your time!
Yeah, I would recommend to use AbstractWorkItemHandler as a base class for all your handlers so you'll get access to session.
As it comes to using that handler in console, you could declare your custom work item handlers inside CustomWorkItemHandlers.conf that is located inside gwt-console-server.war/WEB-INF/classess/META-INF. Just one note, I believe session won't be injected into it. If you don't mind to have a handler that is tightly coupled with console code you could look it up using signleton object StatefulKnowledgeSessionUtil.getStatefulKnowledgeSession().
I've implemented your proposed solution. The tight coupling here isn't really an issue for me, so I went with that approach and it's working great!
Many thanks for your help!
Can i know how you implemented above proposed solution. I am not able to access session in my custom work item handler.