spring-cloud-rsocket
spring-cloud-rsocket copied to clipboard
Document forwarding metadata with dots in keys
I am using ... Spring Boot: 2.2.0.RELEASE Spring Cloud: Hoxton.BUILD-SNAPSHOT Sample project: here "Fixed" project: here
I tried to follow the presentation and declarative routing information as shown here at the Spring One conference.
There is an issue with declarative routing / forwarding information specified in application.yml of an RSocket client, if the route contains dots (.).
Above you can find a sample that consists of the following components:
reservation-service- an RSocket client exposing an endpoint by the routecreate.reservationthat will be called byreservation-service-clientvia the gateway.reservation-service-client- an RSocket client exposing a WebFlux API to receivePOSTrequests that get translated into an RSocket request toreservation-service.service-gateway- the RSocket broker-enabled SCG
With reservation-service-client's application.yml specifying the following routing metadata the gateway will fail forwarding the request with a NullPointerException since the client does not send the routing metadata properly:
spring:
cloud:
gateway:
rsocket:
client:
forwarding:
create.reservation:
service_name: reservation-service
canary: false
The issue is in the dotted syntax of the route, which in a Yaml file gets interpreted as a hierarchy. I guess the matching between the client's called route, and the routing information in Yaml therefore fails.
A working sample is also given above, which uses dashes instead of dots.
To reproduce:
- start
service-gateway - start
reservation-service - start
reservation-service-client - Send a
POSTrequest with empty body tohttp://localhost:6666/reservation/create/RSocketRules
See also #1 which is related, but note that it additionally uses dynamic parts in the route.
See https://github.com/spring-cloud-incubator/spring-cloud-rsocket/issues/1#issuecomment-545088882 for the solution.