Skip to content

Dynamically registration of ServerWebSocketContainer bean #3533

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

Closed
pinkeshsagar-harptec opened this issue Apr 2, 2021 · 0 comments · Fixed by #3548
Closed

Dynamically registration of ServerWebSocketContainer bean #3533

pinkeshsagar-harptec opened this issue Apr 2, 2021 · 0 comments · Fixed by #3548

Comments

@pinkeshsagar-harptec
Copy link

pinkeshsagar-harptec commented Apr 2, 2021

Expected Behavior

I should able to register ServerWebSocketContainer bean with help of application context.

Current Behavior

After dynamically registering ServerWebSocketContainer bean, the HandlerMapping is not getting updated for it's new path and mapping.

Context

I was trying to send notification via websocket on a particular topic but it does not allow to add dynamic topic to existing mappings. Besides that, I am not aware of any workarounds.

I have already asked a question related to this on stackoverflow. Here is the link: https://stackoverflow.com/questions/62553477/spring-integration-to-register-dynamic-serverwebsocketcontainer-paths-so-differe

@pinkeshsagar-harptec pinkeshsagar-harptec added status: waiting-for-triage The issue need to be evaluated and its future decided type: enhancement labels Apr 2, 2021
@artembilan artembilan added in: websocket and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Apr 6, 2021
@artembilan artembilan added this to the 5.5.0-RC1 milestone Apr 6, 2021
@artembilan artembilan self-assigned this Apr 12, 2021
artembilan added a commit to artembilan/spring-integration that referenced this issue Apr 13, 2021
Fixes spring-projects#3533

* Rework `WebSocketIntegrationConfigurationInitializer` to register beans functional way
to avoid reflection for Spring Native support
* Move `IntegrationServletWebSocketHandlerRegistry` into a separate file for better readability
* Implement `DestructionAwareBeanPostProcessor` for `IntegrationServletWebSocketHandlerRegistry`
to track runtime bean registrations and removals
* Introduce an `IntegrationDynamicWebSocketHandlerMapping` to manage runtime mapping
registrations and removals
* Add `servlet-api` dependency into `websocket` to be able to compile an
`IntegrationDynamicWebSocketHandlerMapping`
* Fix typo in the exception message of the `StandardIntegrationFlowRegistration`
* Start dynamically added beans together with associated `IntegrationFlow` in the
`StandardIntegrationFlowContext`
* Document new feature
garyrussell pushed a commit that referenced this issue Apr 13, 2021
* GH-3533: Register WebSocket endpoints at runtime

Fixes #3533

* Rework `WebSocketIntegrationConfigurationInitializer` to register beans functional way
to avoid reflection for Spring Native support
* Move `IntegrationServletWebSocketHandlerRegistry` into a separate file for better readability
* Implement `DestructionAwareBeanPostProcessor` for `IntegrationServletWebSocketHandlerRegistry`
to track runtime bean registrations and removals
* Introduce an `IntegrationDynamicWebSocketHandlerMapping` to manage runtime mapping
registrations and removals
* Add `servlet-api` dependency into `websocket` to be able to compile an
`IntegrationDynamicWebSocketHandlerMapping`
* Fix typo in the exception message of the `StandardIntegrationFlowRegistration`
* Start dynamically added beans together with associated `IntegrationFlow` in the
`StandardIntegrationFlowContext`
* Document new feature

* * Fix language in docs
* Don't start those `SmartLifecycle`s together with a dynamic flow
which are not `isAutoStartup()`

* * Fix `TomcatWebSocketTestServer` to configure servlet for `loadOnStartup = 1`
* Fix `WebSocketDslTests` to make `clientWebSocketContainer.setAutoStartup(true)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants