Loading tutorials
@IsTest. Earlier chapters explained why asynchronous Apex exists: work runs in a separate trans6 min readQueueable class with execute and System.enqueueJob. Here you will learn how a queueable job gets its input and what survives from one j5 min readSystem.enqueueJob does, what the returned ID means, and how to read a job's progress from the AsyncApexJob object.5 min readSystem.enqueueJob, and read an Apex governor limit table. You will learn how to let a queueable call an external service, why the order of DML and callouts matters, and how to test the result.6 min readexecute method. This is called chaining. This chapter covers how to do it, what the child job can and cannot see, and the mistakes that most often break a chain. This chapter assumes you can write a basic Queueable class and enque5 min readSystem.enqueueJob, and chain a child job from execute. It also assumes you know the basic chaining limits. Chained jobs can repeat forever by accident, run too soon, or be enqueued twice. AsyncOptions lets the code that enqu5 min readSystem.attachFinalizer, and read AsyncApexJob records. Here you learn what the platform passes to a finalizer's execute method and how to read it safely.4 min readSystem.attachFinalizer, and read a FinalizerContext. It also assumes you know that DML in a failed transaction is rolled back. Here you combine those pieces into a retry that stops after a fixed number of attempts and 4 min readFinalizerContext. It also assumes you know the basic Apex governor limits and the difference between a synchronous and an asynch4 min read@IsTest classes, create test data, and use Test.startTest() and Test.stopTest(). It also assumes you have read the earlier chapters on queueables, chaining, and finalizers. Here you will see how asynchronous jobs behave inside a test, which parts you can veri5 min readAsyncApexJob. It also assumes you know the governor limits that apply to a transaction. Here you compare the three main asynchronous tools and learn how to pick one for a given workload.6 min read