Chris, Anatoly, Mauricio,

Thanks for your replies. I had implemented a solution similar to that suggested by Chris; my work item handlers are defined as Spring beans, so as long as they are defined with scope="prototype", the knowledge session can be injected into the handler.
I just wondered if there was a "simpler" way of determining the session directly from the work item.

Anyway, thanks again for your help,

Alan




Mauricio Salatino <salaboy@gmail.com>
Sent by: rules-users-bounces@lists.jboss.org

04/05/2010 16:53
Please respond to
Rules Users List <rules-users@lists.jboss.org>

To
Rules Users List <rules-users@lists.jboss.org>
cc
Subject
Re: [rules-users] Drools Flow: how to get knowledge session ID from        WorkItem





Anatoly, if you can share your generic implementation that would be nice.. because a lot of people is looking for something like that.
I prefer custom and domain specific implementation, but it seams that a lot of people is looking for something generic that can be reused.
I can blog about that generic idea too to spread the word and also mention the different situations and the perspective of having decoupled and coupled applications to the work items.

On Tue, May 4, 2010 at 11:16 AM, tolitius <webakaunt@gmail.com> wrote:

@Alan,

   Implementation of WorkItemHandler is a custom ( "your" ) component. This
means that this implementation may have anything injected ( set as property
or at construction time ).

   Let's say you implement "YourCustomWorkItemHandler" to take a "session
id" at the construction time ( good choice :) ), then to start the process
you would:

               session = create a newStatefulKnowledgeSession()

               session.getWorkItemManager().registerWorkItemHandler(
                               "WorkItemName", new YourCustomWorkItemHandler( session.getId() ) );

               session.startProcess( "process-name" );

/Anatoly

--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-how-to-get-knowledge-session-ID-from-WorkItem-tp775649p776358.html
Sent from the Drools - User mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list

rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
-
http://salaboy.wordpress.com
-
http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users