Skip to content

Commit 730c157

Browse files
committed
Introduce ClientRSocketConnector.getRequester()
* Restore `Mono<RSocketRequester> getRSocketRequester()` on `ClientRSocketConnector` and deprecate it in favor of newly introduced `RSocketRequester getRequester()`: there is no need in wrapping a `RSocketRequester` to deferred `Mono` since internal logic of the `RSocketRequester` on client side is based on lazy-load API of the `RSocketClient`
1 parent 2c42c91 commit 730c157

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/ClientRSocketConnector.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.rsocket.transport.ClientTransport;
3030
import io.rsocket.transport.netty.client.TcpClientTransport;
3131
import io.rsocket.transport.netty.client.WebsocketClientTransport;
32+
import reactor.core.publisher.Mono;
3233

3334
/**
3435
* A client {@link AbstractRSocketConnector} extension to the RSocket connection.
@@ -210,7 +211,22 @@ public void connect() {
210211
this.rsocketRequester.rsocketClient().source().subscribe();
211212
}
212213

213-
public RSocketRequester getRSocketRequester() {
214+
/**
215+
* Return the {@link Mono} for the {@link RSocketRequester}.
216+
* @return the {@link Mono} for the {@link RSocketRequester}.
217+
* @deprecated since 5.4 in favor of {@link #getRequester()}
218+
*/
219+
@Deprecated
220+
public Mono<RSocketRequester> getRSocketRequester() {
221+
return Mono.just(getRequester());
222+
}
223+
224+
/**
225+
* Return the {@link RSocketRequester} this connector is built on.
226+
* @return the {@link RSocketRequester} this connector is built on.
227+
* @since 5.4
228+
*/
229+
public RSocketRequester getRequester() {
214230
return this.rsocketRequester;
215231
}
216232

spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSocketOutboundGatewaySpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected RSocketOutboundGatewaySpec(Expression routeExpression) {
4848

4949
/**
5050
* Configure a {@link ClientRSocketConnector} for client side requests based on the connection
51-
* provided by the {@link ClientRSocketConnector#getRSocketRequester()}.
51+
* provided by the {@link ClientRSocketConnector#getRequester()}.
5252
* @param clientRSocketConnector the {@link ClientRSocketConnector} to use.
5353
* @return the spec
5454
* @see RSocketOutboundGateway#setClientRSocketConnector(ClientRSocketConnector)

spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/outbound/RSocketOutboundGateway.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public RSocketOutboundGateway(Expression routeExpression) {
120120

121121
/**
122122
* Configure a {@link ClientRSocketConnector} for client side requests based on the connection
123-
* provided by the {@link ClientRSocketConnector#getRSocketRequester()}.
123+
* provided by the {@link ClientRSocketConnector#getRequester()}.
124124
* In case of server side, an {@link RSocketRequester} must be provided in the
125125
* {@link RSocketRequesterMethodArgumentResolver#RSOCKET_REQUESTER_HEADER} header of request message.
126126
* @param clientRSocketConnector the {@link ClientRSocketConnector} to use.
@@ -207,7 +207,7 @@ protected void doInit() {
207207
super.doInit();
208208
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
209209
if (this.clientRSocketConnector != null) {
210-
this.rsocketRequester = this.clientRSocketConnector.getRSocketRequester();
210+
this.rsocketRequester = this.clientRSocketConnector.getRequester();
211211
}
212212
}
213213

spring-integration-rsocket/src/test/java/org/springframework/integration/rsocket/inbound/RSocketInboundGatewayIntegrationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ void setupTest(TestInfo testInfo) {
9696
this.serverRsocketRequester = serverConfig.clientRequester.asMono().block(Duration.ofSeconds(10));
9797
}
9898
else {
99-
this.clientRsocketRequester =
100-
this.clientRSocketConnector.getRSocketRequester();
99+
this.clientRsocketRequester = this.clientRSocketConnector.getRequester();
101100
}
102101
}
103102

0 commit comments

Comments
 (0)