Schedule jobs for quartz scheduler from other spring boot application - spring

I have two spring boot applications, where one features the creating and scheduling of the job. There is another Spring Boot application where I configured the Quartz Scheduler, which will prepare the job parameters using a shared database and launches the spring batch job.
I need to update the running Quartz Scheduler if the user updates or adds a new job from UI. Also if server restarts I need to restart the Scheduler and the Jobs.
How should I update my Quartz Scheduler object when there's the new job added or updated by the user? My Quartz Scheduler will always be in running condition. Can I use REST Template so that my UI application will notify my scheduler application for the jobs?

You will need to store the jobs to schedule in a database (using the share database) from the UI application, create a job and build a trigger for it.
Its hard to say without any code given, but there is a guide that does something like you want.
https://www.callicoder.com/spring-boot-quartz-scheduler-email-scheduling-example/
This is a dynamic scheduler/trigger

Related

Spring boot job scheduler start and stop

I am new to spring boot scheduler. I want to schedule multiple jobs to start and stop based on user requirements. The start and stop have to be exposed as a restful service. Is there a way to achieve this using a spring scheduler where I can start a job when the user requests it and stop it when a stop is requested?
If you need to trigger method as new thread annotate with #Async.
If need trigger job based on user trigger and stop based on user trigger spring batch good option if its allowed
running spring batch job
jobLauncher.run(job, jobParameter);
stop running job.
jobexplorer.stop(jobExecution.getId);

Running a Spring Boot project with Quartz scheduler on Kubernetes

I am working on a Spring Boot project which has a scheduler service using Quartz. This scheduler service runs a specific scheduled or cron job by calling a separate micro-service.
Now I am planning to deploy my micro-services on kubernetes and I want to make sure that my scheduler service is also clustered. I have noticed that Quartz supports clustering using JDBC-JobStore but I am not entirely sure if such a scenario can be deployed using kubernetes. Will it work if I have 3 pods of the Scheduler service managed and scaled using kubernetes?
Yes as long as you run the quartz in Cluster Mode and set org.quartz.scheduler.instanceId = AUTO it does work.
In case of scaling, just some pods will be added or get removed, Quartz will take care of it since each instance would have its distinct instance ID.

Configuring spring Batch tasks in Spring cloud data flow

I have created a project with 2 rest API that launches different Jobs. My project is connected to a MySql database. I would like to monitor both the Jobs in spring cloud data flow. Please help me out how we need to configure SCDF to MySql so that both the Jobs will be monitored. And additionally, i would like to know that how, if we launch the job by firing the API, whether our SCDF will monitor those Job Instance. If not, please let me know how we can do that.
Thanks in Advance
Please take a moment to read the Spring Batch Admin to SCDF migration guide. It is a requirement that the jobs are wrapped with Spring Cloud Task programming model.
Once you have the batch-job wrapped as a Task, you can register them in SCDF to build Task/Batch pipelines using SCDF's DSL or the GUI.
As for the datasource, all you must have to make sure is that the same datasource is shared between SCDF and the batch-jobs. With this, SCDF's Dashboard will automatically list the jobs and its execution details.
Here are a few examples for your reference.
And additionally, i would like to know that how, if we launch the job by firing the API, whether our SCDF will monitor those Job Instance
Assuming you're referring to SCDF's Task launch API (e.g., a Scheduled trigger or by other means); if triggered, yes, the job executions will be captured in the database as far as SCDF and the batch-jobs share a common datasource as explained previously.

Migration options for scheduler service running in quartz

We have a scheduling service running in weblogic server, implemented using Quartz API and custom db tables to manage create, delete, suspend and resume tasks on configuration of jobs and various pollers (database, jms) with the help of UI framework in Angular JS. Now we decided to go with open source and trying to make use of the capabilities of spring integration.
But with spring integration, any idea how one can dynamically perform create, suspend and resume tasks on a database and JMS pollers? Or can we integrate Quartz with Spring Integration and make use of capabilities of both?
Thanks

Spring #scheduler vs. Quartz Scheduler which one is best

I got in to a task where we have to publish Metadata of one table to another application via REST web services.
Basically need is
It has to be weekly scheduler and every week we push the data to
them.
Synchronous way.
Job scheduler will kick up the job and call REST client.
I am thinking using spring batch scheduler as it is simple and not with Quartz scheduler. Let me know you view and perspectives.

Resources