Forcing synchronous parsing in asynchronous mode

As an alternative to changing the XU deployment descriptor, you can use the API to force ruleset execution to use the last deployed version of the ruleset.

Procedure

To force ruleset execution to the last deployed version in asynchronous mode, use the method IlrSessionRequest.setForceUptodate.

  1. Create a session factory.
    IlrJ2SESessionFactory factory = new IlrJ2SESessionFactory();
  2. Create a stateless session using the factory.
    IlrStatelessSession session = factory.createStatelessSession();
  3. Create a request using the session.
    IlrSessionRequest request = factory.createRequest();
  4. Specify the ruleset path for the request.
    request.setRulesetPath("/myRuleApp/1.0/my_ruleset/1.0");
  5. Set the setForceUptodate method of the request to true.

    The execution is forced to the last deployed version as opposed to using a previous version in the cache.

    request.setForceUptodate(true);

Results

If the last version of the ruleset is not in memory, the execution request triggers the ruleset parsing and waits for it to complete first.

Example

Here is the entire code sample:

IlrJ2SESessionFactory factory = new IlrJ2SESessionFactory();
  
  IlrStatelessSession session = factory.createStatelessSession();
  IlrSessionRequest request = factory.createRequest();
  request.setRulesetPath("/myRuleApp/1.0/my_ruleset/1.0");
  request.setForceUptodate(true);
  
  IlrSessionResponse response = session.execute(request);