I have 5 batch classes (implements Database.Batchable). I was able to add all of them in a single schedulable class (implement Schedulable) and schedule it successfully (code below). It worked.
My questions:
- how many such batch classes can I keep adding to the below schedulable class without errors?
- Are there any limitations?
- What issues would I face?
Thoughts please
global class Schedulable_Notifications_ALL implements Schedulable
{
global void execute(SchedulableContext sc)
{
Batch_Notifications_1 batch1 = new Batch_Notifications_1();
Batch_Notifications_2 batch2 = new Batch_Notifications_2();
Batch_Notifications_3 batch3 = new Batch_Notifications_3();
Batch_Notifications_4 batch4 = new Batch_Notifications_4();
Batch_Notifications_5 batch5 = new Batch_Notifications_5();
Database.executeBatch(batch1,10);
Database.executeBatch(batch2,10);
Database.executeBatch(batch3,10);
Database.executeBatch(batch4,10);
Database.executeBatch(batch5,10);
}
}
Best Answer