I have a requirement where I need to process a list of string having hundreds of records in it . For each string I need to have an http callout so I cant run in a normal apex method. For this I am trying to pass the list to a batch apex class and then execute each callout in the execute method so that I wont hit the callout limit. Here is my problem the start method can return only Database.querylocator or Database.iterable. How to pass a list string from the start method with a specified batch size? below is the code explaining the same
global class DF_BatchToExcessFields implements Database.Batchable<sObject>{
global list<String> batchlist = new list<String>();
global DF_BatchToExcessFields(list<String> lstObjectAsString)
{
batchlist.addAll(lstObjectAsString);
}
global Iterable<sObject> start(Database.BatchableContext info){
//Current code
//str='select id from account'; // just a query for start method
// return Database.getQueryLocator(str);
// My requiremnt is to pass part of list batchlist to execute method
}
global void execute(Database.BatchableContext info, List<account> scope){
//I want to process the string ie http callout here
}
global void finish(Database.BatchableContext info){
}
}