03 Aug IBM Cast Iron: Prefer Batch over Looping
Cast Iron is the product that serves as the cloud adapter in the IBM middleware ecosystem.
In the following examples we will take a look at the TIPs (provided in the database provided by IBM) and how these examples can be modified to use batch processing resulting in more efficient and simple code.
The Following examples will update or insert (upsert) account records in SalesForce.
In the example above there are 2 options
- In the first Scenario (this is the one we downloaded from the TIP database) the poll detects a change and pulls the first record. This record will then be processed by the Orchestration and will be upserted in salesforce. The following record will be only be processed in when the following poll time is reached.
- With minimal change we can achieve a second, improved scenario in which we pull all new records (up to a defined maximum) from the database and upsert them to Salesforce one by one using a loop
In the example above we optimized the orchestration even further and do not only use batch processing to get the records from the database but to upsert them to SalesForce (the maximum amount of objects that the SalesForce API supports is 200 so this would be the optimal size) as well.
When possible use batch processing IBM Cast Iron. It increase the throughput of an orchestration and reduces the system load as well.
It speaks for itself that in the examples used above error-handling is to be implemented in a real world scenario.