I have an interesting challenge, I'm sure there are a few decent solutions but I'd like to get some input from the community. I am building a tool that will allow my users to use the Angel IVR Outbound API (you call it API, it places calls for you. Like Twilio). They run a custom query using the tool and it call's all the resulting records. I have this part working just fine. The challenge is, we want to break the calls up into delayed batches. Reason being that if we place 1000 calls and they all go out immediately and then the people receiving the calls need to call into our customer care center, our help desk people could be quickly overwhelmed by the call volume. So ideally we could pass in a set of IDs and a minute delay as well and have the batch of 1000 broken into groups of say 200 with that minute delay inserted between.
The approach I was thinking of taking is having the main application look and see if a delay time greater than 0 is passed in. If so, instead of just batching and placing the calls (my outbound dialing function already handles the batching) it would schedule an invocation of a scheduable class. That class would then take the entire list of ID's (would have to store them somewhere, not sure where though since I don't think you can pass arguments to a scheduled class). That scheduled class would send one batch and delete those ID's from the set. If there are ID's left it will schedule another invocation of itself X amount of time from now, which will then recursively run until all ID's have been handeled. This seems solid, but there are a few questions.
1) Can a scheduled class schedule another invocation of itself? 2) What would be the best way to store the list of records to dial
Just to get an idea of scope, about the most records we would every deal with this application would be about 10,000, but ideally it could scale up near infinity. The batch size will generally be between 100 and 250. Each batch consists of just one outbound HTTP request to the angel API, as you can include multiple numbers to call per request (up to 250, hence the batch size limit).
Anyway, I'd love to hear some input from other experts and see what you all think might be the best way to approach this. If you are curious what I have for my class already check out my blog at
Particularly the campaignCall function, as that is the one that gets called currently to place calls. Thanks!