Amin Mohammed-Coleman [
http://community.jboss.org/people/amin-mc] created the discussion
"StatefulKnowledgeSession in custom work item handlers"
To view the discussion, visit:
http://community.jboss.org/message/636282#636282
--------------------------------------------------------------
Hello
My application provides the ability to register custom work item handlers. Users
register an instance of the custom handlers and when i create a session i get these
handlers and register them against the statefulknowledgesession. The problem is that some
of these handlers might need access to the StatefulKnowledgesession however I can't
find the best way to inject the session into these handlers. For example I decided to use
StatefulKnowledgeSessionAware interface where i set the session if the handler implements
the handler. The problem with this is that there is a single instance of the handler and
i run the risk that the handler might have a session injected when it is currently already
in use by another session.
What would be great is to have some kind of handler with a method signature
public void executeWorkItemWithSession(WorkItem workItem, WorkItemManager workItemManager,
StatefulKnowledgeSession)
that way it doesn't matter that there is only one instance of the handler everytime
the handler is invoked the session is injected into the method. Is this possible to
achieve? Can i do some extension to support this?
Any help would be appreciated.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/636282#636282]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]