-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application shuts down immediately after connecting to a websocket #9455
Comments
Hi @daniel-oelert ! Would you mind confirming that you still use Java 17? |
Fixes: #9455 Issue link: #9455 * Add an `IntegrationKeepAlive` infrastructure bean to initiate a long-lived non-daemon thread to keep application alive when it cannot be kept like that for various reason, but has to. * Expose `spring.integration.keepAlive` global property to disable an `IntegrationKeepAlive` auto-startup * Test and document the feature
I created the project with Spring Initializr and Java 21. No explicit virtual threads configuration was used. |
Can you share such a simple project with us? I mentioned WebSocket client in my fix, but my impression might be false and we really may fail to keep alive only when virtual threads are there. |
Sure! I have attached a zip of a minimal project. Let me know if that is what you needed. |
Thank you for the sample!
to make it emitting data when
So, our non-daemon And apparently
|
Thank you for the help and especially for the quick response! |
Reopen after revert (2cf2f10). For now the Sorry for inconvenience. |
I wrote a simple Spring Integration app that connects to a websocket, using
spring-integration-websocket
.Expected Behavior
The app connects to the websocket and keeps listening for new messages.
Current Behavior
Once connected the application shuts down immediately, since there is no non-daemon thread running, as pointed out by @artembilan on stackoverflow (https://stackoverflow.com/questions/78961574/why-does-my-spring-integration-app-just-shutdown-without-listening/) and the canonical way to keep this from happening is to use the property
spring.main.keep-alive=true
.Context
It seems like a strange convention to keep this as the default. I think it would make sense to make the default the inverse of the current behavior.
A working example:
The text was updated successfully, but these errors were encountered: