[rules-users] 5.1.0 CR1: Drools Spring Configuration Changed?

Mark Proctor mproctor at codehaus.org
Mon Jul 26 17:39:10 EDT 2010


  On 26/07/2010 22:23, tolitius wrote:
> that is interesting:
>
>      <drools:work-item-handlers>
>        <drools:work-item-handler name="handlername" ref="handlerid" />
>      </drools:work-item-handlers>
>
> I already implemented it via simple<util:map>, and have a team of ~ 50
> developers already using it for the last three months ( did not know it was
> coming with namespace support ). Although as I think about it, since we have
> processes and sub-processes, I would rather keep workitem handlers process
> oriented rather than session oriented. Two reasons:
>
>          1. "Workitem" is a process oriented entity
Work Items are a generic concept and not process oriented, we have plans 
to make them easily usable from the guided editor too.
>          2. Sub-Process configuration can be de-coupled, and hence painlessly
> modified / reused
not sure what you mean. Please provide an xml sample of what you would 
like added.
> But all the namespace additions are truly a great addition to the Drools
> portfolio.
I did a lot of work streamlining the xml for compact declarativeness.
> I have a question about this new approach though:
>
>        >>>  Using JPAKnowledgeServiceBean, anytime I needed to create a new
> Session, I could:
>
> 		StatefulKnowledgeSession knowledgeSession =
> 			knowledgeProvider.newStatefulKnowledgeSession();
>
>        >>>  Using JPAKnowledgeServiceBean, anytime I needed to reload a
> Session, I could:
>
>                 knowledgeSession =
> knowledgeProvider.loadStatefulKnowledgeSession( sessionId );
Spring can create the session for you, as in the example. Or you can get 
spring to create a kstore reference and use that to instantiate the 
ksession.
<drools:kstore id="kstore1" />

Which returns a KnowledgeStoreService implementation:
     StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeBase 
kbase,
                                                          
KnowledgeSessionConfiguration configuration,
                                                          Environment 
environment);

     StatefulKnowledgeSession loadStatefulKnowledgeSession(int id,
                                                           KnowledgeBase 
kbase,
                                                           
KnowledgeSessionConfiguration configuration,
                                                           Environment 
environment);


> I always have one Session to one Business Process mapping ( there are
> multiple reasons for that outside of the scope of this question ).
>
> What is the new way you have in mind? [ I have ideas, I just want to make
> sure I don't double work you again ]
>
> Thank you Mark,
> /Anatoly
>
> P.S. All Sessions / Processes + RuleGroupsFlowsAgendas... are persistent [
> JPA ]





More information about the rules-users mailing list