[rules-users] Ksession inside a executeWorkitem() ?

Cristiano Gavião cvgaviao at gmail.com
Mon Mar 2 14:39:00 EST 2009


Hi Kris,

Hummm... Its true, after all Workitem stills been a java class with  
gets and sets... ;-)

Thanks

Cristiano

On 02/03/2009, at 10:38, Kris Verlaenen wrote:

> Cristiano,
>
> If the working memory is always different per work item, you could  
> use a global and pass it as a parameter of the work item.
>
> However, in general it does seem better to set this on the work item  
> handler directly at construction time, as a parameter on your work  
> item handler. Something like this:
>
> StatefulKnowledgeSession session = ...
> MyWorkItemHandler myWorkItemHandler = new MyWorkItemHandler();
> session.getWorkItemManager().registerWorkItemHandler("...",  
> myWorkItemHandler);
> myWorkItemHandler.setSession(session);
>
> If you have more than one possible session, you could inject a  
> session locator instead of the session itself to locate the session  
> at runtime.
>
> Kris
>
> ----- Original Message ----- From: "Cristiano Gavião" <cvgaviao at gmail.com 
> >
> To: "Rules Users List" <rules-users at lists.jboss.org>
> Sent: Monday, March 02, 2009 2:19 PM
> Subject: [rules-users] Ksession inside a executeWorkitem() ?
>
>
>> Hi people,
>>
>> Im trying to create a workitemhandler for use Drools Pipeline and   
>> Smooks to import data inside working memory and process it.
>>
>> I want to share the working memory that was created for the main   
>> process that is calling the workitem for configure the Drools  
>> Pipeline  inside it.
>>
>> What is the best approach to do that, use Globals to pass the  
>> knowledgesession?
>>
>> any ideias?
>>
>> Thanks in advance
>>
>> _________________________
>> Cristiano V. Gavião
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

_________________________
Cristiano V. Gavião

É difícil acreditar que um homem esteja a dizer a verdade, quando você  
sabe muito bem que mentiria se estivesse no lugar dele. Henry Menken





More information about the rules-users mailing list