Have any one of you come across a situation, where I need to call queueable class from batch. To give you more details, let us a scenario - I have a scheduler, which will run after particular time of interval; which will call a batch method withing its execute method. Lets say batch of Cases which needs to processed.
In batch for each entry, we need to have 1 callout + process data 1 callout + DML in sync.
We tried following thing:
Batch class:
lObject = List of object(which needs to be processed)
for(Object o: lObject)
{
if( Limits.getQueueableJobs() <= 25)
{
System.debug('in batch class limits : ' + Limits.getQueueableJobs() );
System.enqueueJob(new queueableClass(o));
}
else break;
}
Queueable Class:
- callout1
- processData
- Again enqueue- newEnqueueClass
- newEnqueueClass : Insert data
- future callout [since we cannot have callout after DML].
PS:For some reason, we cannot bulkify callout(due to 3rd party system limitation).
What should be ideal solution to this problem?