RSocketRequester is Spring’s client API for sending messages to an RSocket server and receiving reactive responses. Spring Boot automatically provides an RSocketRequester.Builder bean, which you can inject and use to create a requester connected over TCP. section 14.2.1 section 14.4
A request-response call follows a short chain:
- Create a requester with requesterBuilder.tcp("localhost", 7000). section 14.2.1
- Select the server route with route("greeting"), then provide the request payload with data("Hello RSocket!"). section 14.2.1
- Declare the response type with retrieveMono(String.class) and subscribe to handle the returned Mono. section 14.2.1
- Pass route variables as arguments, such as route("greeting/{name}", who). section 14.2.1
Send a greeting
RSocketRequester tcp = requesterBuilder.tcp("localhost", 7000);\n\ntcp\n .route("greeting")\n .data("Hello RSocket!")\n .retrieveMono(String.class)\n .subscribe(response -> log.info("Got a response: {}", response));
