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?
A Dropwizard Environment consists of all the Resources, servlets, filters, Health Checks, Health, Jersey providers, Managed Objects, Tasks, and Jersey properties which your application provides.
Because you can't be a web application without HTTP, Dropwizard uses the Jetty HTTP library to embed an incredibly tuned HTTP server directly into your project.
Dropwizard is an open source Java framework for developing ops-friendly, high-performance RESTful backends. It was developed by Yammer to power their JVM based backend. Dropwizard provides best-of-breed Java libraries into one embedded application package.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With