|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IlrStatelessSession
IlrStatelessSession
represents a stateless rule session.
A stateless session is a session where the server treats each request as an
independent transaction that is unrelated to any previous request.
The following code example shows how to execute rules in a Java SE session.
public IlrSessionResponse executeRulesOnJ2SESession(Customer user, ShoppingCart cart) throws IlrFormatException, IlrSessionException { IlrSessionFactory factory = new IlrJ2SESessionFactory(); IlrStatelessSession session = factory.createStatelessSession(); IlrSessionRequest sessionRequest = factory.createRequest(); sessionRequest.setRulesetPath(IlrPath.parsePath(rulesetPath)); // Ensure correct version of the ruleset is taken in account sessionRequest.setForceUptodate(true); sessionRequest.setTraceEnabled(true); sessionRequest.getTraceFilter().setInfoAllFilters(true); // Set the input parameters for the execution of the rules MapinputParameters = new HashMap (); Announcement announcement = new Announcement(); inputParameters.put("announcement", announcement); inputParameters.put("customer", user); inputParameters.put("shoppingCart", cart); sessionRequest.setInputParameters(inputParameters); IlrSessionResponse sessionResponse = session.execute(sessionRequest); return sessionResponse; }
Method Summary | |
---|---|
IlrSessionResponse |
execute(IlrSessionRequest request)
Executes a ruleset based on a request and returns the execution response. |
void |
executeAsynchronous(IlrSessionRequest request,
IlrAsyncExecutionObserver observer,
long timeout)
Executes a ruleset asynchronously. |
Method Detail |
---|
IlrSessionResponse execute(IlrSessionRequest request) throws IlrSessionException
IlrSessionException
- if an error occurred during ruleset execution.request
- The request, this object contains execution details.
void executeAsynchronous(IlrSessionRequest request, IlrAsyncExecutionObserver observer, long timeout) throws IlrSessionException
observer
is notified. This
method does not block until either execution is completed or an error
is raised.
IlrSessionException
- if an error occurred during ruleset execution.request
- The request, this object contains execution details.observer
- The observer that is notified when execution is
complete.timeout
- The waiting time when the observer has not been
notified of execution completion.
|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |