我正在向quartz scheduler添加一个作业。之后,我调用附加的调试打印作业功能。它没有列出工作。对public function getExport($id)
{
$data = Students::whereIn('id', explode(',', $id))
->get();
$filename = "students.csv";
$handle = fopen($filename, 'w+');
fputcsv($handle, array('name', 'class', 'section'));
foreach ($data as $student)
{
fputcsv($handle, array($student->name, $student->class, $student->section));
}
fclose($handle);
$headers = array(
'Content-Type' => 'text/csv',
);
return \Response::download($filename, 'students.csv', $headers);
}
的函数调用可能仅限于返回最大值。 10个工作岗位?
getCurrentlyExecutingJobs()
答案 0 :(得分:1)
方法getCurrentlyExecutingJobs()
将仅返回正在运行的作业,而不是每个预定作业
要完成每项预定的工作,你应该这样做:
Scheduler scheduler = getScheduler();
try {
// All scheduled jobs
for (String groupName : scheduler.getJobGroupNames()) {
for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
final List<? extends Trigger> triggersOfJob = scheduler.getTriggersOfJob(jobKey);
// Do something with the info you just got
// ...
}
}
} catch (SchedulerException e) {
log.error("Retrieving jobs", e);
}