Vote count:
0
This is my Requirement:
Need application or Task which runs on 24/7 with configurable Time interval(in Delphi).
What i did so far:
So i have decided to go for Windows service. Then I have created the windows service in Delphi.
The process is
1. Created Windows service Start():
procedure TDemo.ServiceStart(Sender: TService; var Started: Boolean);
begin
MyServiceThread := TMyThread.Create(False); //Call the thread
MyServiceThread.Resume;
end;
2. Windows service stop();
procedure TDemo.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
MyServiceThread.Terminate;
end;
Thread's Execute method:
procedure TMyThread.Execute; begin MyTask(); end;
MyTask() have some functionality and it may take 30 secs to 5 min time to complete the task.
If Now i start the Service,then it call execute method and call MyTask() inside it. Then i t completes task. It will happen only once. Because no Looping at all.
Then i have created the Task scheduler and set Time interval of 10 mins and call the batch file which Starts my Windows service and Stops.
Now Everything is working fine. Every 10 min my tasks was completed.
What are all the other possibility to do this instead of Task Scheduler? Is it possible to do inside Service itself? which one is best method?
Thinking and found one solutions:
1.Creating the Timer inside the Thread. But Timer needs to set time as Configurable one.It may be one day or one week and so on..What is the maximum time support by Timer?
Is it possible to do with timer?
Is any other way to do this?
Please give me some suggestion to go for better solution.
Suggestion needed for Scheduling Service
Aucun commentaire:
Enregistrer un commentaire