Timeline for Working around callout limit in Batch Apex
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 24, 2016 at 17:22 | comment | added | Justin | I need to do multiple calls per companyId - depending on how many results are returned for that company id | |
May 24, 2016 at 17:00 | comment | added | Phil Hawthorn |
SInce you're doing one callout per companyId then you could return your Set<Id> companyIds as your iterable in start() then call the WS one at a time
|
|
May 24, 2016 at 16:43 | comment | added | Justin | Would it be possible to have my initial class create an interable object of the URLs that need to be called, and then have another batch run (with a size of 1) for each of those interable objects? How would I invoke that batch call from the current batch call? Also - would I have to use an custom object to hold those URLs? | |
May 24, 2016 at 16:12 | comment | added | Justin | Edited to add code | |
May 24, 2016 at 16:00 | comment | added | Phil Hawthorn |
I wasn't suggesting that, I was suggesting you pass the 2500 records back as an iterable from the start method so you could process them 1 by 1 (or, 100 by 100). You can call a batchable from a batchable from the finish() method. You could also use Queueable interface to perform the callouts from the batchable. Would need to see your code really....
|
|
May 24, 2016 at 15:51 | comment | added | Justin | Currently, my batchable looks for records that need to have the call run, and then within the execute is making the calls - so even if my batch size is 1, if there are more than 2500 results returned, it will still hit the limit. Are you suggesting that I move the callout to a new batchable class? Can you call a batchable from a batchable? | |
May 24, 2016 at 15:39 | history | answered | Phil Hawthorn | CC BY-SA 3.0 |