GH-3207: RSocket inbound: decode each flux item (#3208)
* GH-3207: RSocket inbound: decode each flux item Fixes https://github.com/spring-projects/spring-integration/issues/3207 Previously an incoming RSocket Publisher has been decoded as a single unit leading to extra work on the client side, e.g. a delimiter has to be provided to treat each payload item as independent * To have a consistency with Spring Messaging and its `PayloadMethodArgumentResolver` change an `RSocketInboundGateway` to process inbound payloads as `Flux` and decode each item independently. * Change `RSocketDslTests` to remove delimiters and make it consistent with the regular `RSocketRequester` client * * Add `decodeFluxAsUnit` option into `RSocketInboundGateway` * Document the change
This commit is contained in:
@@ -137,6 +137,12 @@ The `payload` of the message to send downstream is always a `Flux` according to
|
||||
When in a `fireAndForget` RSocket interaction model, the message has a plain converted `payload`.
|
||||
The reply `payload` could be a plain object or a `Publisher` - the `RSocketInboundGateway` converts both of them properly into an RSocket response according to the encoders provided in the `RSocketStrategies`.
|
||||
|
||||
Starting with version 5.3, a `decodeFluxAsUnit` option (default `false`) is added to the `RSocketInboundGateway`.
|
||||
By default incoming `Flux` is transformed the way that each its event is decoded separately.
|
||||
This is an exact behavior present currently with `@MessageMapping` semantics.
|
||||
To restore a previous behavior or decode the whole `Flux` as single unit according application requirements, the `decodeFluxAsUnit` has to be set to `true`.
|
||||
However the target decoding logic depends on the `Decoder` selected, e.g. a `StringDecoder` requires a new line separator (by default) to be present in the stream to indicate a byte buffer end.
|
||||
|
||||
See <<rsocket-java-config>> for samples how to configure an `RSocketInboundGateway` endpoint and deal with payloads downstream.
|
||||
|
||||
[[rsocket-outbound]]
|
||||
|
||||
@@ -98,3 +98,9 @@ See <<./ws.adoc#ws,Web Services Support>> for more information.
|
||||
|
||||
The `FailoverClientConnectionFactory` no longer fails back, by default, until the current connection fails.
|
||||
See <<./ip.adoc#failover-cf,TCP Failover Client Connection Factory>> for more information.
|
||||
|
||||
[[x5.3-rsocket]]
|
||||
=== RSocket Changes
|
||||
|
||||
A `decodeFluxAsUnit` option has been added to the `RSocketInboundGateway` with the meaning to decode incoming `Flux` as a single unit or apply decoding for each event in it.
|
||||
See <<./rsocket.adoc#rsocket-inbound,RSocket Inbound Gateway>> for more information.
|
||||
|
||||
Reference in New Issue
Block a user