-2

I have a requirement to send SOAP message to lot of devices everyday at a certain time. I will get the time from a tomcat parameter in web.xml. Something like;

<context-param>
    <param-name>DailyTime</param-name>
    <param-value>04:00</param-value>
</context-param>

I must create a separate thread that sends the messages. Time will be in 24-hrs format.

The problem is, as a starter i have no idea where to start or how to do it. Can you guys please point me in the right direction or give me some tips, which will help me greatly.

Thank You Everyone :)

Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68

1 Answers1

0

You have several options. The two I've used most in the past are:

1) Schedule a cron job to run at the time(s) you want, and have it call an executable java class / jar file.

2) Use a scheduler library like Quartz

Regarding #1 - this assumes you're using a *nix system. If you're using Windows, you can schedule tasks through the Task Scheduler.

Regarding #2 - this gives you more flexibility on the conditions of running a task/job. For example, you could schedule a job to run every 1 minute, but not to start a new job until any existing job is complete.

Anecdotal remark from a version of Quartz circa 2006 - on WebSphere, it seems that my quartz jobs were getting executed by some background thread that made jobs take hours which should have only taken a few seconds. But that was almost a decade ago, and certainly quartz (and hopefully websphere) have vastly improved.

Gojira
  • 2,941
  • 2
  • 21
  • 30