[rules-users] How to declare custom accumulators in kmodule.xml?

Edson Tirelli ed.tirelli at gmail.com
Tue Dec 3 12:43:34 EST 2013


   Alexis,

   This was not exposed in the kmodule and we are discussing the best way
to do it. Ideally, we want to reduce in 6 the complexities of configuration
we had in 5, and for accumulate functions, we are thinking the best would
be to simply support them in imports in the DRL file. So, for instance, to
use a function foo() in a rule, one would do (pseudo code for now):

import function org.bar.FooFunction.foo;

    Or a similar construct. Happy to hear your thoughts about this compared
to a module/system wide configuration like we had in 5. We will do this
over the next few days.

    Having said that, for those already using accumulate functions and
migrating to Drools 6, the work around until we get this in place is to use
the "old" way, adding a configuration file to the META-INF directory:

META-INF/drools.packagebuilder.conf

    And setting the custom functions in there as properties (e.g.):

drools.accumulate.function.foo = org.bar.FooFunction
..

    We will get this sorted out in the next few days, if anyone wants to
contribute their thoughts, it is welcomed.

    Edson



On Tue, Dec 3, 2013 at 11:52 AM, abr <alexis.brouard at haulogy.net> wrote:

> Hello everyone,
>
> I tried to move from Drools 5.5.0.Final to 6.0.0.Final and I've some issues
> with moving from declaring kbase in Spring to the new kmodule.xml.
>
> My main concern for the moment is about custom accumulators.
> In the 5.5.0.Final Spring config, I had something like :
>
> <bean id="myAcc"
> class="my.namespace.rules.accumulators.MyCustomAccumulator"
> />
>
> <drools:kbase id="kb1">
>   <drools:resources>
>      [...]
>   </drools:resources>
>
>   <drools:configuration>
>     <drools:accumulate-functions>
>       <drools:accumulate-function name="myAcc" ref="myAcc" />
>         [...]
>     </drools:accumulate-functions>
>   </drools:configuration>
> </drools:kbase>
>
>
> I've thoroughly read the 6.0.0.Final documentation and the
> kie-spring-6.0.0.xsd (found here:
>
> https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-spring/src/main/resources/org/kie/spring/kie-spring-6.0.0.xsd
> )
> but I haven't find a way to declare custom accumulators.
>
> I also tested my luck by changing all "drools:" by "kie:" but with no
> success.
>
> Would you point me to a working example of declaring custom accumulators in
> 6.0.0.Final?
>
> Thanks in advance.
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-declare-custom-accumulators-in-kmodule-xml-tp4027073.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Principal Software Engineer
  Red Hat Business Systems and Intelligence Group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20131203/a69c8a1f/attachment-0001.html 


More information about the rules-users mailing list