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

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Mon Mar 2 08:38:58 EST 2009


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 




More information about the rules-users mailing list