0

On application start I am initializing a map containing some client request data.

public void onStart(@Observes StartupEvent ev) {
     // initializing a map
}

I would like to extend graceful shutdown functionality: my service should not shutdown until one of the following conditions is met:

  • configured period of time has passed (quarkus.shutdown.timeout config property)
  • all clients have responded (already supported by Quarkus -> HTTP requests)
  • my custom map is empty

How can I subscribe to a shutdown event so I can check during graceful period if my custom map is empty?

  • Have you looked at `@Observes ShutdownEvent ev` as mentioned in https://quarkus.io/guides/lifecycle#listening-for-startup-and-shutdown-events? – geoand May 20 '22 at 10:29
  • @geoand Unfortunately, it is not helping because it will be triggered after graceful period of time has passed or all requests are finished. What I would like to achieve is to check if my custom map is empty during that graceful period. I tried to play with ShutdownListener (tried to implement it), but I failed. It seems to me like I maybe need to add new extension so I can somehow use ShutdownListenerBuildItem, but I wanted to check if it is the right way to do it... – martina505 May 20 '22 at 12:17
  • You can certainly try. I admit I don't understand your use case fully, so I can't tell whether it will work or not – geoand May 23 '22 at 05:15

0 Answers0