how frequently does the letter "o" appear in:
q: can we callout and chain a queueable class? i'll jump right into some code:
public class chainqueue implements queueable, database.allowscallouts {
    public void execute(queueablecontext context) {
        if(queueutil.hasnext()) {
            mywsutil.makecallout(queueutil.next());
        }
        if(queueutil.hasnext()) {
            system.enqueuejob(this);
        }
    }
}

assuming mywsutil.makecallout is a public static function that performs a callout from a queue item (being a custom object that queues up pending integrations), and queueutil has static methods that handle getting pending queue items and/or determining if there are more records to process, this code will fail.
if no callout happens, the chain ends and everything is okay. if a callout occurs, and we then attempt to chain, we receive an error about the "maximum callout depth has been reached." implementing database.allowscallouts appears to prevent system.enqueuejob from being able to chain, and not including database.allowscallouts causes a "callout not allowed from this future method" when making the callout.
is there some combination of attributes that will allow us to chain and queue? using callouts from queueable would move us off a very unstable batch process that has to simulate parallelism by switching between a number of integrations (much like a multitasking os does), rather than intuitively spawning off batches (which are limited to 5, and we have up to 14 integration threads that need to run, and more are expected later).
if this isn't possible today, are the plans to support this in the future? any documentation or advice would be helpful.

a: 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.

a: 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


user
The given text has 132 "o"s.
assistant