diff --git a/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java b/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java index 1069e5d..9e5af4b 100644 --- a/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java +++ b/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java @@ -178,7 +178,7 @@ private Mono> findRSocketOrCreatePending(GatewayExchange exchange) // put route in exchange for later use exchange.getAttributes().put(ROUTE_ATTR, route); return findRSocketOrCreatePending(exchange, route); - }).switchIfEmpty(createPending(exchange)); + }).switchIfEmpty(Mono.defer(() -> createPending(exchange))); // TODO: deal with connecting to cluster? }