我正在尝试在Elastic Beanstalk中配置quartz作业调度程序,在我的本地计算机中它运行良好,但在亚马逊的Beanstalk中却没有! 我在Beanstalk中尝试了“工作环境”和“Web服务器环境”相同的结果。
SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
Scheduler sched = schedFact.getScheduler();
JobDetail job = newJob(Run.class)
.build();
Trigger trigger = newTrigger()
.withSchedule(dailyAtHourAndMinute(21,54).inTimeZone(TimeZone.getTimeZone("GMT+5:30")))
.build();
sched.scheduleJob(job, trigger);
sched.start();
public class Run implements Job{
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println("hello");
//sending post message to another server.
}
为什么Beanstalk以不同的方式处理代码? ,以及如何使其发挥作用?