Submitting batch requests by using a custom integration application

Use the IBM® Integration API to group multiple requests that are destined for the same integration node, and submit them as a single unit of work.

About this task

To start a batch, your application must call the beginUpdates() method on the BrokerProxy handle. The IBM Integration API delays submitting any state-changing requests to the integration node until it is told a batch of requests is ready to be sent.

The sendUpdates() method tells the IBM Integration API to submit as a batch all requests received since the last beginUpdates() call. The clearUpdates() method can be used to discard a batch without submitting it to the integration node. The application can check if a batch is currently in progress by using the isBatching() method. Only one batch for an IBM Integration API handle can be in progress at any one time.

One advantage of using a batch method is that it provides an assurance that no other applications can have messages processed by the integration node during the batch. When an integration node receives a batch of requests, it processes each request in the batch in the order it was added to the batch (FIFO), and requests from no other custom integration application are processed until the entire batch is completed.

Consider the following sequence of commands:
ExecutionGroupProxy e = b.createExecutionGroup("EG2");
e.deploy("mybar.bar");

Without using a batch method, the application cannot guarantee the success of these actions. For example, even if each command would otherwise succeed, a second (possibly remote) application might delete the integration server EG2 after it has been created by the first application, but before the other command is processed.

If the sequence is extended to use a batch method, the integration node is now guaranteed to process all the commands together, therefore no other application can disrupt the logic intended by the application.
b.startUpdates();
ExecutionGroupProxy e = b.createExecutionGroup("EG2");
e.deploy("mybar.bar");
b.sendUpdates();

In a situation that requires lots of requests to be sent in quick succession, the use of a batch has a significant effect on performance, reducing both time taken to process the requests, and the memory used. For example, your application might create a number of integration servers on a single integration node.

Batch mode does not provide transactional (commit and backout) capability; some requests in a batch might succeed and others fail. If the integration node processes a request in a batch that fails, it continues to process the next request in the batch until it has attempted all requests in the batch.