Auto-Configure RSocket support for Spring Integration

This commit adds a new auto-configuration for RSocket support in Spring
Integration.

Given an application with `spring-messaging`, `spring-integration-rsocket`
and RSocket dependencies, developers are now able to leverage Spring
Integration features with RSocket.

It is now possible to configure an RSocket server with
`"spring.rsocket.server.*"` properties and let it use
`IntegrationRSocketEndpoint` or `RSocketOutboundGateway` components to
handle incoming RSocket messages. This infrastructure can handle Spring
Integration RSocket channel adapters and `@MessageMapping` handlers
(given `"spring.integration.rsocket.server.message-mapping-enabled"`is
configured.

If the `"spring.integration.rsocket.client.host"` and
`"spring.integration.rsocket.client.port"` (for TCP protocol), or
`"spring.integration.rsocket.client.uri"`  (for WebSocket) is configured
then a `ClientRSocketConnector` will be configured accordingly.

Closes gh-18834

Co-authored-by: Brian Clozel <bclozel@pivotal.io>
This commit is contained in:
Artem Bilan
2020-03-03 15:15:24 +01:00
committed by Brian Clozel
parent 8dd0ef9b39
commit 3967e76b9b
5 changed files with 277 additions and 2 deletions

View File

@@ -5932,6 +5932,21 @@ If `spring-integration-jdbc` is available, the default database schema can be cr
spring.integration.jdbc.initialize-schema=always
----
If `spring-integration-rsocket` is available, developers can configure an RSocket server using `"spring.rsocket.server.*"` properties and let it use `IntegrationRSocketEndpoint` or `RSocketOutboundGateway` components to handle incoming RSocket messages.
This infrastructure can handle Spring Integration RSocket channel adapters and `@MessageMapping` handlers (given `"spring.integration.rsocket.server.message-mapping-enabled"` is configured).
Spring Boot can also auto-configure an `ClientRSocketConnector` using configuration properties:
[source,properties,indent=0,configprops]
----
# Connecting to a RSocket server over TCP
spring.integration.rsocket.client.host=example.org
spring.integration.rsocket.client.port=9898
# Connecting to a RSocket Server over WebSocket
spring.integration.rsocket.client.uri=ws://example.org
----
See the {spring-boot-autoconfigure-module-code}/integration/IntegrationAutoConfiguration.java[`IntegrationAutoConfiguration`] and {spring-boot-autoconfigure-module-code}/integration/IntegrationProperties.java[`IntegrationProperties`] classes for more details.
By default, if a Micrometer `meterRegistry` bean is present, Spring Integration metrics will be managed by Micrometer.