Created
July 16, 2012 06:56
-
-
Save rtrcolin/3121212 to your computer and use it in GitHub Desktop.
Dropwizard Quartz Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.yammer.dropwizard.Service; | |
... | |
public class QuartzService extends Service<QuartzConfiguration> { | |
public static void main(String[] args) throws Exception { | |
new Quartz Service().run(args); | |
} | |
public QuartzService() { | |
super("Quartz Service"); | |
} | |
@Override | |
protected void initialize(QuartzConfiguration config, Environment env) throws Exception { | |
// In subsequent posts will we add more stuff here | |
... | |
// Create a Quartz scheduler factory from properties in the Service YML config | |
SchedulerFactory sf = new StdSchedulerFactory(config.getSchedulerFactoryProperties()); | |
QuartzManager qm = new QuartzManager(sf); // A Dropwizard Managed Object | |
env.manage(qm); // Assign the management of the object to the Service | |
env.addHealthCheck(new QuartzHealthCheck(qm)); // Add the health check to the service | |
... | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment