Databases Reference
In-Depth Information
Note that for each fact that we have configured as an output of the decision function,
we should ensure that just a single fact of that type will reside within the working
memory of the decision service upon completion of execution of the ruleset. If zero
or multiple facts exist, then the decision service will return an exception.
Session management
Before executing a ruleset, the decision service must first obtain a rule session.
Creating a rule session involves creating a RuleSession object and loading the
required repository that has significant overhead. Instead of creating a new
RuleSession to handle each request, the decision service maintains a pool
of shared objects that it uses to service requests.
When we invoke a decision function within a composite, the decision service will
allocate a RuleSession object from this pool to handle the request.
In most scenarios, once the decision service has returned a result to the caller,
the final step is to reset the session, so that it can be returned to the pool of
RuleSession objects and be reused to handle future requests. This pattern
of invocation is known as a stateless request, as the state of the session is not
maintained between operations.
However, for invocations within a BPEL process, the decision service also supports a
stateful invocation pattern, which enables you to invoke multiple operations within
the same session when more flexibility is required.
For example, within the first invocation, you could assert some facts, execute the
ruleset, and retrieve the results (without resetting the session). Based on the result,
you may then take one of multiple paths within your BPEL process, at which point,
you may re-invoke the decision service asserting some additional facts, re-execute
the ruleset and retrieve an updated result, and then reset the rule session.
However, stateful sessions should be used with care as the state of the rule session
is not persisted as part of the dehydration of a BPEL process, so it won't survive a
server shutdown.
By default, when a decision function is created within the rules
editor, it has the Stateless checkbox selected. You will need to
deselect this if you want the function to support stateful invocations.
 
Search WWH ::




Custom Search