Skip to content

Auto Configure ClientRSocketConnector and ServerRsocketConnect for Spring integration RSocket #18812

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
hantsy opened this issue Oct 30, 2019 · 4 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@hantsy
Copy link

hantsy commented Oct 30, 2019

When I created a sample project to taste Spring Integration RSocket, but I have to create ServerRSocketConnector and ClientRSocketConnector beans. And the ServerRSocketConnector will create a new RSocket server that could cause a port binding error when running it as a standalone Spring Boot RSocket application if using the same port number.

See: https://stackoverflow.com/questions/58603425/error-running-spring-integration-rsocket-sample-with-spring-boot

It is better to provide auto-configuration to detect the existing RSokcet server and create Spring Integration RSocket facilities based on the existing.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 30, 2019
@artembilan
Copy link
Member

I think we should consider to auto-configure a ClientRSocketConnector only in tests when we would like to verify RSocket requests against started RSocket server for test scope. In most cases with random port.

It really does not make sense to always instantiate a ClientRSocketConnector whenever we detect RSocket support.
We may consider to have something like spring.integration.rsocket.client.uri configuration property to indicate that we need to create a particular RSocket client though...
But at the same time we can simply live with a direct ClientRSocketConnector instantiation when we also can inject auto-configured RSocketStrategies.

For the server side I need to think more from Spring Integration perspective.
Right now there is no way to co-locate a regular Spring Messaging @MassageMapping approach and Spring Integration IntegrationRSocketEndpoint in the same RSocket server...
The ServerRsocketConnect just encapsulates the whole logic to start a new server - no way to bind to existing one what is done here in Spring Boot.

artembilan added a commit to artembilan/spring-integration that referenced this issue Nov 1, 2019
Related to: spring-projects/spring-boot#18812

* Extract `ServerRSocketMessageHandler` into a `public` class to allow
to configure it as top-level bean and bind it into an existing server
* Change `ServerRSocketConnector` to accept the mentioned external bean
and don't create an internal RSocket server with an assumption that it
is create externally
* Add `IntegrationRSocketMessageHandler.requestMappingCompatible`
option to allow to configure `ServerRSocketMessageHandler` for both
Spring Integration RSocket channel adapters and regular `@MessageMapping`.
This is useful for Spring Boot auto-configuration

These changes give a hook to auto-configure Spring Integration RSocket
channel adapters in Spring Boot
artembilan added a commit to artembilan/spring-boot that referenced this issue Nov 1, 2019
Fixes spring-projects#18812

To reuse RSocket server auto-configuration in Spring Integration,
introduce an `IntegrationAutoConfiguration.IntegrationRSocketConfiguration`
based on the `ServerRSocketMessageHandler` from Spring Integration which
overrides an `RSocketMessagingAutoConfiguration` when SI is present on
classpath.
Configure a `ServerRSocketMessageHandler` from SI which is able to handle
SI RSocket channel adapters and `@MessageMapping` if configured via
new `IntegrationProperties.RSocket.Server.messageMappingEnabled`.
Then add a `ServerRSocketConnector` which is based on the provided
`ServerRSocketMessageHandler`.
Also auto-configure a `ClientRSocketConnector` if
`IntegrationProperties.RSocket.Client.port` or
`IntegrationProperties.RSocket.Client.uri` configuration properties are
present
garyrussell pushed a commit to spring-projects/spring-integration that referenced this issue Nov 1, 2019
Related to: spring-projects/spring-boot#18812

* Extract `ServerRSocketMessageHandler` into a `public` class to allow
to configure it as top-level bean and bind it into an existing server
* Change `ServerRSocketConnector` to accept the mentioned external bean
and don't create an internal RSocket server with an assumption that it
is create externally
* Add `IntegrationRSocketMessageHandler.requestMappingCompatible`
option to allow to configure `ServerRSocketMessageHandler` for both
Spring Integration RSocket channel adapters and regular `@MessageMapping`.
This is useful for Spring Boot auto-configuration

These changes give a hook to auto-configure Spring Integration RSocket
channel adapters in Spring Boot
@philwebb
Copy link
Member

philwebb commented Nov 5, 2019

Closing in favor of PR #18834

@philwebb philwebb closed this as completed Nov 5, 2019
@philwebb philwebb added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 5, 2019
@hantsy
Copy link
Author

hantsy commented Mar 1, 2020

Hi, I have refactored my samples using Spring Boot RSocket and Spring Integration RSocket, I have some issues about interaction between them.

I described it in a new question on stackoverflow.

The sample codes can be found here.

@artembilan

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants