Hi,
I have a situation with a Dropwizard service running on multiple servers in an active-active fashion behind a load balancer. The load balancer is verifying that each service instance is running by calling the "/ping" endpoint. If a response hasn't been received in 20 seconds, that service instance is considered dead and will not get any more requests until ping returns 200 again. In order to do seamless deployment, I want to have a shutdown hook such that the ping endpoint returns !200 for 20 seconds before shutting down the http server. During those 20 seconds, I want the service to function normally except for the ping response.
I have looked at using managed objects and using the "stop()" method, but it seems like the http server has already shutdown by then (as suggested by https://groups.google.com/forum/#!topic/dropwizard-user/UP1krCq--cA).
I have also looked at using a task like what is suggested in https://stackoverflow.com/questions/31288721/dropwizard-shutdown-hook/31296783#31296783 but I'm not a situation where I can make a http request before killing the jvm.
Any suggestions on how this can be acheived?
We also ran into this issue. A fix for this is included in https://github.com/dropwizard/dropwizard-health.
See the code/configs for delayedShutdownHandlerEnabled and shutdownWaitPeriod in particular.
This is exactly what I was looking for!
I haven't used dropwizard modules before so not entirely sure how they work. There seems like there is only one version available on maven central: https://repo1.maven.org/maven2/io/dropwizard/modules/dropwizard-health/, which is on version 1.3.11-1, thus not the same version as latest dropwizard: https://repo1.maven.org/maven2/io/dropwizard/dropwizard-core/1.3.12/. Are the modules not a part of the normal release flow of Dropwizard?