0

I am trying to setup an environment with Docker containers in which I run Spring Cloud Applications. I am using Zuul as gateway and Eureka for service discovery.

Now, what I am trying to do, is when I send SIGTERM signal through docker stop command and the Java process is shutting down, I need to catch somehow this event, put the service OUT_OF_SERVICE in Eureka registry, then wait some time, and then shut it down, as mentioned by @spencergibb here: Make Spring Cloud app to wait for eureka clients to remove it before fully shutting down

Do you happen to know how to do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
anghel adrian
  • 162
  • 2
  • 14

1 Answers1

1

You can use actuator's shutdown endpoint /actuator/shutdown to gracefully shutdown spring cloud application, consider doing that in an JVM shutdown hook.

evanwoods
  • 79
  • 4