Skip to main content

Posts

Showing posts from 2021

Quick Tips: Queueable Apex : Loose Coupling with Chainable Interface

Queueable Apex : Loose Coupling with Chainable Interface Intro to Queueable Apex Time and again, we come across use cases where we have to either perform an extensive processing, which can breach governor limits, or we want to perform some work asynchronously for improved user experience. Queueable apex provides us a means to create an asynchronous job (An asynchronous job means a piece of work, which is scheduled to run in background, for e.g. you may want to do custom rollup calculations on opportunity save). Queueable apex is similar to future methods, wherein your future method is queued within a server queue. Server picks up the job and executes it, based on resource availability. However, there are some differences, quite notably: Queueable apex returns an ID for further enquiry Queueable apex methods can invoke external API (if Queueable apex class implements Database.AllowsCallouts interface) Queueable apex methods can enqueue other queueable apex jobs Say, we have a simple Qu