Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 786
IAmYourFaja Avatar asked Dec 21 '14 20:12

IAmYourFaja


People also ask

What is managed in Dropwizard?

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.

Does Dropwizard use Jetty?

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.

What is Dropwizard framework?

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.


1 Answers

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.

like image 58
Mirko Adari Avatar answered Sep 23 '22 08:09

Mirko Adari