0

We are trying to use Drool as our rule engine service. What we done till now is listed below

Most of our requirements satisfied by stateless session (Give a set of data, execute the rule and return the data, that's it) . But using stateless we have to compromise many of the important features provided by Drools stateful session.

So we are trying to use stateful session per request. Which means the session should get disposed as soon as the request end. Also, parallel request should not interfere each other even if the session name is same

We found about container runtime strategy configuration (Workbench > Deploy > {any container} > Process Configuration > Runtime strategy)

enter image description here

But even after configure the container strategy to Per Request, it still behave same as Singleton (the session is not getting disposed after each request)

Few place we read it as, run time strategy only implemented in jBPM

The way we make request to KIE server is shown below

 Request: POST {HOST}/kie-server/services/rest/server/containers/instances/TestRequest_1.0.4 
 {
   "lookup": "ab-session", //stateful session
   "commands": [
     {
       "insert": {
         "out-identifier": "125",
         "object": {
           "com.myteam.testrequest.Product": {
            "id": "123",
            "name": "Hoo Hoo",
            "count": 0
           }
         },
         "return-object": "true"
       }
     },
     {
       "insert": {
         "out-identifier": "126",
         "object": {
           "com.myteam.testrequest.Product": {
            "id": "123",
            "name": "Hoo Hoo",
            "count": 0
           }
         },
         "return-object": "true"
       }
     },
     {"fire-all-rules": "hf2"}
   ]
  }

We need help in achieving this requirement. Also, please help understand if we done something wrong

Vishal Vijay
  • 2,518
  • 2
  • 23
  • 45
  • Where you able to solve this? – Michael Kalika Jan 28 '18 at 14:37
  • Some of our understanding was not right. Stateless session in drools is actually a per request implementation of Stateful session. Which means all the commands supported in stateful is also supported in stateless. (We initially thought `modify` like commands are not supported in stateless session) If you want answer for per request strategy, that is only available in `jBPM ` – Vishal Vijay Jan 28 '18 at 21:42

1 Answers1

0

In kmodule.xml you may try to add "prototype" scope, because default is "singleton":

<ksession name="SessionName" type="stateful" default="false" clockType="realtime" scope="prototype"/>
Almas Kamitov
  • 93
  • 1
  • 6