Can DropWizard support scheduled tasks?

DropWizard allows you to define administrative tasks and execute them remotely by clicking on the URL. DropWizard applications also have several built-in administration tasks, such as a garbage collector, that can be deleted by sending a GET to http(s)://yourapp.example.com:8081/tasks/gc .

I'm wondering if DropWizard has built-in support for scheduling tasks. For example, using the GC task as an example, it would be nice to schedule garbage collection every 3 hours or at midnight, etc.

Obviously, I could include something like Quartz to achieve this, but why reinvent the wheel if I DropWizard already supports this out of the box? The way it is?

+5
source share
2 answers

While DropWizard does a great job with everything you might need, they don't. Probably because it's pretty simple to use the JDK API to plan simple things.

However, there are many services for DropWizard that provide good integration with Quartz, etc. One example here is https://github.com/spinscale/dropwizard-jobs .

Check this topic to learn more about what other people have done in a similar situation - https://groups.google.com/forum/#!topic/dropwizard-user/WmDjhWsms8I .

+6
source

After thinking about this for a while, my solution was to run my task in AWS Lambda using the schedule setting in Cloudwatch (I still use Dropwizard for my configurations, etc.). This is something to consider.

0
source

Source: https://habr.com/ru/post/1209671/


All Articles