Summary
In this chapter, we learned how to effectively utilize Batch Apex as a tool so that we can make changes to large volumes of data or process work as and when resources are available.
We started this chapter by reviewing what Batch Apex is and the different common use cases for Batch Apex. Some of these use cases can also be achieved with other tools, so it is important that when you are reviewing Batch Apex as a potential tool, you compare it appropriately with other options. It is not a silver bullet to simply help you work with an increased set of governor limits.
Following this, we looked at the different ways in which we can define a Batch Apex class to meet these use cases and the difference between using QueryLocator
and Iterable
to define the scope of the job. As noted, it is most common to use a QueryLocator
object as it allows the greatest amount of scale for data volumes.
We then looked at how we can invoke Batch Apex processes in a one-off, scheduled, and...