[jboss-user] [jBPM] - StatefulKnowledgeSession in custom work item handlers

Amin Mohammed-Coleman do-not-reply at jboss.com
Sat Nov 12 10:37:39 EST 2011

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


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

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111112/90ccdc7f/attachment.html 

More information about the jboss-user mailing list