开发者

Play framework asynch job compared to a Windows Service?

开发者 https://www.devze.com 2023-03-28 20:45 出处:网络
I have a windows service that checks an email account and then saves off an attached PDF that has a barcode in it. I read the barcode and route the PDF to an appropriate directory. The service runs ev

I have a windows service that checks an email account and then saves off an attached PDF that has a barcode in it. I read the barcode and route the PDF to an appropriate directory. The service runs every 5 minutes and has been working well.

So my questions:

Should I create Play Job for this? Do I c开发者_运维百科onstantly needs hits on the site to kick off the site? Would the job run at 2am when there's no hits?

I am trying to learn what the limitations of the Jobs are and what the alternatives would be.


As Pere says, Play Jobs are very similar to Cron, in that it can use the CRON syntax to describe when to execute the task (using Quartz).

The only reason this would not work, is if you are running in Dev mode, as the server needs to be active before these tasks are executed, and Dev mode waits for the first hit before the server properly becomes active.

As for whether it is worth doing it, the one thing I love about Play jobs, is that it is clear in the code when they will be executed, and all of your application logic is held in one place, rather than distributed over different techniques and technologies.

One limitation however of having the timings of when the job should execute inside the code, is you have to make a code change if you want to re-configure, which normally has been left to sys-admin type people. This entirely depends on your viewpoint of which is most easily manageable.


Jobs in Play are like CronJobs, you set the time/frequency and they will run even if there is no traffic incoming and it's 2am.

But if you already have the service running and working fine, unless you are moving to a new system were it would not be able to run (like Linux), there is no reason to reimplement it.

0

精彩评论

暂无评论...
验证码 换一张
取 消