Chapter 7: Utilizing Future Methods
The first of the asynchronous Apex options we have are future methods. Future methods are a form of functions as a service that Salesforce provides. These methods enable you to execute some code in a fire-and-forget manner. In this paradigm, a function is called for execution (the firing) and placed on a queue to be processed when resources are available (forget). Salesforce will execute future method calls when resources are available on the Salesforce servers. In my experience, this tends to be near-instant unless you are performing a large volume of asynchronous processes.
In this chapter, we are going to discuss how to use future methods, some common use cases, and how to test them appropriately. As part of this discussion, we will also see where they fit into the different architectural options available to a developer working on the platform.
In this chapter, we will study the following topics:
- When to use a future method ...