Calling a Cron Trigger stored in JDBCJobStore programmatically - quartz-scheduler

I have a Cron Trigger configured using the JDBCJobStore since we will be running the app within a clustered environment.
I have the CronTrigger running every 10AM, everything is working great.
How would I programmatically start this Cron Trigger "On-Deman". Any code sample appreciated.
I'm using Quartz 1.6.5 on Tomcat 6.0.
Thanks for any help.

If you know the name and group of the job you wish to run "on demand", and you have programmatic access to the scheduler, you could schedule a new SimpleTrigger to run once and immediately.
http://quartz.sourceforge.net/javadoc/org/quartz/Scheduler.html
Note that this would not start the cron trigger, I am assuming your goal is to actually run the job your cron trigger points to. If you have code that relies on TriggerListeners listening to your cron trigger, this will not help.

Related

Talend Automation Job taking too much time

I had developed a Job in Talend and built the job and automated to run the Windows Batch file from the below build
On the Execution of the Job Start Windows Batch file it will invoke the dimtableinsert job and then after it finishes it will invoke fact_dim_combine it is taking just minutes to run in the Talend Open Studio but when I invoke the batch file via the Task Scheduler it is taking hours for the process to finish
Time Taken
Manual -- 5 Minutes
Automation -- 4 hours (on invoking Windows batch file)
Can someone please tell me what is wrong with this Automation Process
The reason of the delay in the execution would be a latency issue. Talend might be installed in the same server where database instance is installed. And so whenever you execute the job in Talend, it will complete as expected. But the scheduler might be installed in the other server, when you call the job through scheduler, it would take some time to insert the data.
Make sure you scheduler and database instance is on the same server
Execute the job directly in the windows terminal and check if you have same issue
The easiest way to know what is taking so much time is to add some logs to your job.
First, add some tWarn at the start and finish of each of the subjobs (dimtableinsert and fact_dim_combine) to know which one is the longest.
Then add more logs before/after the components inside the jobs.
This way you should have a better idea of what is responsible for the slowdown (DB access, writing of some files, etc ...)

Bluemix Workload Scheduler trigger does not start

I tried to create a job to call a REST API every 10 minutes using the Application Lab UI of the Workload Scheduler.
The task works fine, if I push Run Now.
This is the configuration of my trigger:
I left out valid to intentionally to have this task running infinitely.
Looking the trigger you created seems to be right: your step will run every 10 minutes every days.
If not, could you specify what is not working?
Thanks

PgAgent jobs not executing on remote server

I don't understand why this isn't working, I set up a pgAgent job to send a NOTIFY from the database every hour
The steps
The schedule
Turns out that problem was that heroku doesn't support agAgent and the database was running on heroku, I ended making a work around the scheduling tasks using windows task scheduler - it's not the best solution but it does the job I needed to do...

Quartz Scheduler trigger are stuck

We've got a problem with stuck triggers in an application using Quartz Scheduler version 1.8.6 when jobs do not complete.
For example, we have jobs with ssh calls or database queries. If these jobs hang (because the ssh call does not terminate or the select statement has a table lock), then I cannot get the jobs to trigger any more. The triggers are stuck until I forcibly restart the scheduler.
I have tried to Scheduler.interrupt(trigger) and Scheduler.rescheduleTrigger(). I have tried removing the trigger and recreating it. I have removed the job and recreated it.
The result is the same: I can restart the job, but the trigger hangs and is not run again.
Please disregard this question. I had problems with my installation which were unrelated to Quartz.
Scheduler.interrupt() is the correct method, and is working perfectly for me now.

how to load/boostrap ongoing jobs with a quartz jdbcStore

I am working to migrate from Quartz 1.6 to 2.1 and use a JDBCJobStore. Previously, the the jobs were loaded via an xml file when the webapp started. The scheduler is now running using the JDBCJobStore but I don't understand how to add the jobs to the database which need to run on an ongoing basis (not one-off jobs).
My first thought is to create a servlet which runs on startup which adds the jobs to the database. But my concern is that this will be executed every time I need to restart the app and the jobs will get duplicated.
Thanks,
steve
The Jobs wont disappear from the database when you do a restart. So within your servlet, when it starts up before adding any jobs check to see if they already exist. When you create your jobs you can give them identities. Using the identities and some quartz methods you check if they already exist.
It sounds like the memory based scheduler is a better fit for these fixed jobs. You can create more than one scheduler, one memory, one JDBC if that makes sense for your application.