Can we callout and chain a Queueable class?

As Dan Appleman notes in the latest edition of Advanced Apex, a Queueable can call a Future method, and a Future method can enqueue a Queueable job. This works in Spring 16, and will allow chaining of an unlimited number of Queueable jobs, regardless of whether they do a callout or not.

public without sharing class thisQueueable 
    implements Queueable, Database.AllowsCallouts
{
    //...

    @Future(callout=true)
    public static void tryToQueue()
    {
        System.enqueueJob(new thisQueueable());
    }


}

This should allow you to chain Queueables indefinitely.


Spring '17 provides:

Make Web Service Callouts from Chained Queueable Jobs

Apex now allows web service callouts from chained queueable jobs. Previously, a queueable job could make a web service callout, but additional chained jobs that made callouts would throw exceptions.

See Also:

Idea Exchange: Allow Callouts from Chained Queueable Apex Jobs