spring quartz running locally. NOT STARTED - spring

I'm using spring 3.0, jpa hibernate for the persistence,so i want to use quartz 1.8.5 with spring 3.0 to call my method that starts with checking some paramerter in DB before sending the files.
The problem is that the DB code is never called and in the log file i have the following message:
[QuartzScheduler] INFO - Scheduler meta-data: Quartz Scheduler
(v1.8.5) 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0'
with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
The code without the quartz part (Spring, Jpa .. ) works fine.
I test the same quartz config to call a simple method printHello and it works well also.
Any indication will be really appreciated.
Thank's

Related

Quartz scheduler not starting

I have seen this question being posted multiple times, going back as far as 7 years but no proper answer has been posted so I am getting a little desperate.
I saw some posts in which the answer implied that the issue was with the jobs already scheduled. So I deleted my quartz database and recreated it. Even then when I start the springboot REST service, I get the following message in the log;
2022-04-18 18:44:15.091 INFO 19884 --- [ restartedMain]
org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz
Scheduler (v2.3.2) 'quartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED. Currently in standby mode. Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 5
threads. Using job-store
'org.springframework.scheduling.quartz.LocalDataSourceJobStore' -
which supports persistence. and is not clustered.
Does anybody have any idea.
I have no specific quartz specific configuration in my project.

Scheduler in spring using quartz, invoking an endpoint not happening based on the schedule

I'm trying to create a scheduler in spring using Quartz. During the application booting, job, trigger and scheduler have been configured. In executeJob(), I'm printing hello and invoking an endpoint. Hello is getting printed as per the schedule, but the endpoint is not being invoked.
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

Spring boot, Kotlin, Kafka and shutdown

I have a Spring boot / Kotlin application that has a Kafka listener embedded. I am programmatically shutting it down at some point by calling:
configurableApplicationContext.close()
However, Kafka listener does not shut down at that time and instead I get this:
Failed to shut down 1 bean with phase value 2147483547 within timeout of 30000: [org.springframework.kafka.config.internalKafkaListenerEndpointRegistry]
After that, the app shuts down as expected.
What do I need to do differently so it shuts down cleanly when requested?

Schedule jobs for quartz scheduler from other spring boot application

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

Spring batch Spring integration

We are using spring batch 2.1.x coupled with spring integration 2.0 for the poller jobs. There are scheduled jobs as well in the mix.The launching of all these poller and scheduled jobs happen by invoking the spring batch api. We have around 60-65 jobs in total. Very frequently in the production environment what we are seeing is the jobs go into "starting" and they do not recover. So once we observe such occurrences we have to keep restarting our servers which contains our spring batch application. The backend of the spring batch datasource is Oracle 11gr2.

Resources