IAmYourFaja
IAmYourFaja

Reputation: 56944

Does DropWizard natively support scheduled tasks?

DropWizard allows you to define administrative tasks and execute them remotely by hitting a URL. DropWizard apps also have a few built-in admin tasks, such as the Garbage Collector, which can be hit by sending a GET to http(s)://yourapp.example.com:8081/tasks/gc.

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

Obviously, I could incorporate something like Quartz to achieve this, but why reinvent the wheel if I DropWizard already natively supports this out of the box? So does it?

Upvotes: 11

Views: 12621

Answers (2)

Ryan Shillington
Ryan Shillington

Reputation: 25177

After thinking about this for a while, my solution to this was to run my task in AWS Lambda using a schedule setup in Cloudwatch (still using Dropwizard for my configs, etc). It's something to consider.

Upvotes: 0

Mirko Adari
Mirko Adari

Reputation: 5103

While DropWizard is pretty great at having everything you might need available, they don't have this. Probably because it is pretty easy to just use JDK APIs to schedule simple things.

However, there are a lot of services available for DropWizard that provide a nice integration with Quartz etc. One example is here https://github.com/spinscale/dropwizard-jobs.

Check this thread for more ideas on what other people in a similar situation have done -- https://groups.google.com/forum/#!topic/dropwizard-user/WmDjhWsms8I.

Upvotes: 12

Related Questions