micronaut-core icon indicating copy to clipboard operation
micronaut-core copied to clipboard

Provide event that runs before network shutdown

Open yawkat opened this issue 3 years ago • 1 comments

Discussed in https://github.com/micronaut-projects/micronaut-core/discussions/8303

Originally posted by krzemienmichal November 8, 2022 Hello,

I'm using Micronaut version 3.2.6 I have Websocket server application and I've got a problem which I'm not sure if it's a bug or it works as intended. To be specific inside my Websocket server class I'm defining @OnClose method and custom onShutdown method which is annotated with @EventListener and uses ApplicationShutdownEvent. In case of application closure without any open connections custom shutdown methods work fine, however if there's any open connection @OnClose method runs firstly and close connection with AbnormalClosure reason, then shutdown event works. Is this correct behavior? Do you have any ideas how I can solve this in such a way that shutdown event will work before OnClose and send correct ClosureReason? I found that someone had similar problem in thread #6354 but it's and old thread and it was not answered there. Let me know if you need more details.

Thanks for help in advance.

yawkat avatar Nov 09 '22 07:11 yawkat

Can you please confirm that this is still an issue in the latest version of Micronaut?

ojebari-ma avatar May 26 '25 01:05 ojebari-ma