@Shreya Gupta It seems like you have already implemented the shutdown hook using the @PreDestroy annotation, but it is not working as expected. In that case, you can try setting the terminationGracePeriodSeconds
property in your Azure Spring Apps configuration. This property specifies the duration in seconds after processes running in the app instance are sent a termination signal before they're forcibly halted. You can set this value longer than the expected cleanup time for your process. The value must be a non-negative integer. Setting the grace period to 0 stops the app instance immediately via the kill signal, with no opportunity to shut down. If the value is nil, Azure Spring Apps uses the default grace period, which is 90 seconds.
You can also try setting the initialDelaySeconds
property to a higher value in your health probe configuration. This property specifies the number of seconds after the app instance has started before probes are initiated. The default value is 0, the minimum value.
If this answer was of any help, please consider accepting it as an answer or providing a positive survey. If you require further assistance, please reply via a comment to this answer so we can assist you further.