A Queueable Apex class implements the System.Queueable interface. The interface has exactly one method: void execute(QueueableContext context).
The minimum legal Queueable
public class SimpleQueueable implements Queueable {
public void execute(QueueableContext qc) {
System.debug('Running queueable job: ' + qc.getJobId());
}
}
Submit it with System.enqueueJob(new SimpleQueueable()); — that call returns the Id of the resulting AsyncApexJob.
Optional marker interfaces
Depending on what your job needs to do, you can also implement:
| Interface | Purpose |
|---|---|
Database.AllowsCallouts | Required to make HTTP callouts from execute() |
Schedulable | Lets the same class be scheduled via System.schedule() |
Finalizer (separate class) | Run cleanup after the job completes, success or fail |
public class CalloutQueueable implements Queueable, Database.AllowsCallouts {
public void execute(QueueableContext qc) {
HttpResponse res = new Http().send(buildRequest());
// ...
}
private HttpRequest buildRequest() { return null; }
}
Why Queueable over @future
- Typed inputs — constructor can take SObjects, custom Apex classes, lists, maps. Future methods only accept primitives.
- Job Id —
System.enqueueJobreturns an Id you can monitor inAsyncApexJob. - Chaining — call
System.enqueueJobfrom insideexecute()to chain another Queueable (up to 5 deep in production, unlimited in tests). - Finalizers — attach a
System.Finalizerfor post-job cleanup, which future methods can’t do.
Common follow-ups
- Full namespace? —
System.Queueable. TheSystemnamespace is implicit soimplements Queueableworks without import. - How many can I queue in one transaction? — In a synchronous transaction, up to 50 jobs via
enqueueJob. From inside a Queueable, only 1 (the next chained job).
Verified against: Apex Developer Guide — Queueable Apex. Last reviewed 2026-05-17 for Spring ‘26.