liveBook · Manning

RSocketRequester

As explained in Spring in Action, Sixth Edition

RSocketRequester is a Spring client API for constructing and sending RSocket requests and receiving their reactive responses.

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));

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains builder injection, TCP connection, routes, payloads, Mono retrieval, subscription, and route variables.
Examples
Demonstrates greeting requests, variable routes, localhost TCP communication, and reactive response logging.
What it assumes
Assumes basic Spring configuration and reactive types while demonstrating requester construction and request-response calls.
What you can do after
Apply it via Spring Boot to create a TCP requester, send routed payloads, and process Mono responses.
How it connects
Connects RSocketRequester with Spring Boot, Reactor, Mono, Flux, TCP, WebSocket, and request-response communication.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.