Some flow should execute some code in batch, so you need to add a batch job for the corresponding RunBaseBatch class.
Solution
public static void scheduleBatch()
{
BatchHeader batchHeader;
BatchInfo localBatchInfo;
YourRunBaseBatchClass yourRunBaseBatchClass;
SysRecurrenceData sysRecurrenceData =
SysRecurrence::defaultRecurrence();
;
yourRunBaseBatchClass =
YourRunBaseBatchClass::construct();
// retry 3 times
sysRecurrenceData =
SysRecurrence::setRecurrenceEndAfter(
sysRecurrenceData, 3);
// retry after 1 minute
sysRecurrenceData =
SysRecurrence::setRecurrenceUnit(sysRecurrenceData,
SysRecurrenceUnit::Minute, 1);
localBatchInfo = yourRunBaseBatchClass.batchinfo();
localBatchInfo.parmGroupId("YourBatchGroupId");
batchHeader = batchHeader::construct();
batchHeader.addTask(yourRunBaseBatchClass);
batchHeader.parmRecurrenceData(sysRecurrenceData);
batchHeader.save();
}
No comments:
Post a Comment