Batch Operations

When Aware IM executes the FIND action itruns a query and finds instances of business objects that match the conditions of the query. The instances found are written into the Context (see How Context is Formed) and any further actions operate with the found instances. If the number of found instances is large enough further operations happen in batches. This means that instead of operating on all instances at once further actions operate only on a subset of instances (a batch). When the query is run for the first time the first batch is returned. After all actions finish their execution the query is run again and the next batch is returned. Action execution continues until no more batches are returned by the query. At each iteration after actions finish execution of the current batch the database transaction is committed.

For example, consider the following process consisting of two rules:

Rule 1:

FIND Account WHERE Account.Balance < 100 

Rule 2:

Account.State = 'CLOSED' 

The first rule runs a query that finds all accounts with balances less than 100. The second rule changes the state of found accounts. If the number of accounts found by the query is larger than the batch size the query will initially return only the first batch and the second rule will change the states only of the first batch. After the second rule finishes processing the first batch the transaction is committed (so the changes to the first batch are not rolled back if an error occurs when processing any subsequent batches). After committing the first batch the rule 1 is executed again and the query returns the second batch. This process continues until the query returns the last batch.

The size of the batch is 1000 by default, but the default value may be overridden by specifying the size explicitly in the FIND action.

  • Last modified: 2022/09/13 18:15