Skip to content

QueueableWithCalloutRecipes

pozil edited this page Nov 14, 2024 · 15 revisions

QueueableWithCalloutRecipes Class

Demmonstrates the use of the Queueable interface to make callouts. The methods in this class are called by the system at run time. To enqueue this job and see it's results, use System.enqueueJob(new QueueableWithCalloutRecipes());

More on the Queable interface: https://sfdc.co/queueable-apex

Group Async Apex Recipes

See RestClient

Implements

Queueable, Database.AllowsCallouts

Fields

throwError

TESTVISIBLE

Signature

private static throwError

Type

Boolean


circuitBreakerThrown

TESTVISIBLE

Signature

private static circuitBreakerThrown

Type

Boolean

Methods

execute(qc)

This is the only required method to implement Queueable. Queueable classes that also implement Database.allowsCallouts can make HTTP requests to external services. In this recipe we make a GET request to developer.salesforce.com

Signature

public static void execute(QueueableContext qc)

Parameters

Name Type Description
qc QueueableContext dependency injected by the system

Return Type

void

Example

System.enqueueJob(new QueueableWithCalloutRecipes());

Classes

QueueableWithCalloutRecipesException Class

Internal custom exception class

Clone this wiki locally