1 Reply Latest reply on Jun 26, 2009 1:08 AM by beve

    Stateful ContentBasedRouter

      Hi,
      I have been trying to run a simple ContentBasedRouter scenario with stateful Drools. Applying load for a while, I eventually run out of memory as the Drools session is never dispose.

      I haven't gotten further with this memory issue, but are there anyone who have tried this out successfully (or not:) in a working system?

        • 1. Re: Stateful ContentBasedRouter
          beve

          Hi,

          when you have a stateful working memory you need to dispose of it manually.

          From the ServicesGuide.pdf:

          Stateful execution takes place over time, with several messages being sent to the rule service, the rules being executed each time, the message and / or facts being updated each time, and a final message that tells the rule service to dispose of the stateful session working memory of the rule engine.

          Using stateful rule execution requires a few properties to be added the messages.
          For the first message,
          message.getProperties().setProperty("dispose", false);
          message.getProperties().setProperty("continue", false);

          For all the subsequest messages but the final message,
          message.getProperties().setProperty("dispose", false);
          message.getProperties().setProperty("continue", true);

          For the final message,
          message.getProperties().setProperty("dispose", true); /
          message.getProperties().setProperty("continue", true);

          These can be added directly by an ESB aware client. A non-ESB aware client would have to communicate the position of the message (first, ongoing, last) in the data, and an action class would need to be added to the pipeline to add the properties to the ESB message (see quickstarts/business_ruleservice_stateful for an example of this type of service).

          If you are doing the above and still seeing this problem then I think that it is a bug. If so, could you create a Jira and provide as much info as required to reproduce this.

          Thanks,

          /Daniel