1

I need to start spring scheduling based on the constraint that my scheduler job will run every 5 seconds after a receive a jms message from other component. What can be the possible way to implement /handle this scenario ,googled for the same but the solutions ask me to have a property in properties file for enabling scheduling which again is static approach.

Kindly suggest some solutions.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
Rajeev Akotkar
  • 1,377
  • 4
  • 26
  • 46

1 Answers1

1

You can use:-

Thread.sleep(long delay) after receiving a message from JMS queue i.e. Thread.sleep(300000);

Basically your problem is not related to a scheduler. The message received from the queue is a trigger to invoke the job in your case.

Whereas the scheduled tasks are the ones which keeps repeating them periodically either based on fixed delay or fixed interval or at specific time.

Your job is event based and not on time based so its not a scheduled job.

Amit Bhati
  • 5,569
  • 1
  • 24
  • 45
  • after I get the message I have execute that method every 5 seconds .Is some thing not possible by aid of spring – Rajeev Akotkar Sep 04 '15 at 21:16
  • http://stackoverflow.com/questions/14630539/scheduling-a-job-with-spring-programmitically-with-a-fixedrate-set-from-a-databa/14632758#14632758 check this link if it helps. – Amit Bhati Sep 04 '15 at 21:22