Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a better exception message when Quartz is used #10633

Closed
lordofthejars opened this issue Jul 10, 2020 · 0 comments · Fixed by #10754
Closed

Create a better exception message when Quartz is used #10633

lordofthejars opened this issue Jul 10, 2020 · 0 comments · Fixed by #10754
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@lordofthejars
Copy link
Contributor

Description

With a pure programmatic Quartz approach, with a code like:

@ApplicationScoped
public class PeriodicTask {

@Inject
Scheduler quartz;

public void start() throws SchedulerException {
final JobDetail job = newJob(MyJob.class)
.withIdentity("questions", "millionaire")
.build();

final SimpleTrigger trigger = newTrigger()
.withIdentity("questionsTrigger", "millionaire")
.startNow()
.withSchedule(
SimpleScheduleBuilder.simpleSchedule()
.withIntervalInSeconds(20)
.withRepeatCount(5))
.build();

quartz.getListenerManager()
.addTriggerListener(new EndTriggerListener("EndTrigger"),
keyEquals(triggerKey("questionsTrigger", "millionaire")));
quartz.scheduleJob(job, trigger);
}
}

You get the next exception:

Caused by: java.lang.IllegalStateException: Cannot produce org.quartz.Scheduler - Quartz scheduler is disabled or no schedules were found
	at io.quarkus.quartz.runtime.QuartzScheduler.produceQuartzScheduler(QuartzScheduler.java:69)

When you add the next property:

quarkus.quartz.force-start=true

Then everything works as expected, so I think that it would be nice to have a better error message saying, I couldn't generate the Scheduler, maybe you have not set the property to true? So people can figure out quickly what is the problem.

@lordofthejars lordofthejars added the kind/enhancement New feature or request label Jul 10, 2020
@mkouba mkouba self-assigned this Jul 15, 2020
@mkouba mkouba added this to the 1.7.0 - master milestone Jul 15, 2020
mkouba added a commit to mkouba/quarkus that referenced this issue Jul 15, 2020
... and org.quartz.Scheduler is injected
- resolve quarkusio#10633
@gsmet gsmet modified the milestones: 1.7.0 - master, 1.6.1.Final Jul 16, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
3 participants