@ -192,6 +192,19 @@ This is the most basic way to connect with default settings:
@@ -192,6 +192,19 @@ This is the most basic way to connect with default settings:
@ -209,6 +222,35 @@ The above is deferred. To actually connect and use the requester:
@@ -209,6 +222,35 @@ The above is deferred. To actually connect and use the requester:
`RSocketStrategies` is designed for re-use. In some scenarios, e.g. client and server in
the same application, it may be preferable to declare it in Spring configuration.
@ -271,21 +328,40 @@ infrastructure that's used on a server, but registered programmatically as follo
@@ -271,21 +328,40 @@ infrastructure that's used on a server, but registered programmatically as follo
<1> Use `PathPatternRouteMatcher`, if `spring-web` is present, for efficient
route matching.
<2> Create responder that contains `@MessageMaping` or `@ConnectMapping` methods.
<3> Use static factory method in `RSocketMessageHandler` to register one or more responders.
Note the above is only a shortcut designed for programmatic registration of client
responders. For alternative scenarios, where client responders are in Spring configuration,
you can still declare `RSocketMessageHandler` as a Spring bean and then apply as follows:
@ -301,6 +377,20 @@ you can still declare `RSocketMessageHandler` as a Spring bean and then apply as
@@ -301,6 +377,20 @@ you can still declare `RSocketMessageHandler` as a Spring bean and then apply as
<1> Start the request asynchronously, independent from handling.
<2> Perform handling in the suspending function.
[[rsocket-requester-requests]]
@ -371,12 +487,24 @@ Once you have a <<rsocket-requester-client,client>> or
@@ -371,12 +487,24 @@ Once you have a <<rsocket-requester-client,client>> or
val locations = requester.route("locate.radars.within") // <1>
.data(viewBox) // <2>
.retrieveFlow<AirportLocation>() // <3>
----
<1> Specify a route to include in the metadata of the request message.
<2> Provide data for the request message.
<3> Declare the expected response.
@ -393,8 +521,7 @@ The `data(Object)` method also accepts any Reactive Streams `Publisher`, includi
@@ -393,8 +521,7 @@ The `data(Object)` method also accepts any Reactive Streams `Publisher`, includi
same types of values, consider using one of the overloaded `data` methods to avoid having
type checks and `Encoder` lookup on every element:
@ -405,10 +532,17 @@ The `data(Object)` step is optional. Skip it for requests that don't send data:
@@ -405,10 +532,17 @@ The `data(Object)` step is optional. Skip it for requests that don't send data:
{gh-rsocket-extentions}/CompositeMetadata.md[composite metadata] (the default) and if the
@ -418,14 +552,29 @@ values are supported by a registered `Encoder`. For example:
@@ -418,14 +552,29 @@ values are supported by a registered `Encoder`. For example:
fun rsocketMessageHandler() = RSocketMessageHandler().apply {
routeMatcher = PathPatternRouteMatcher()
}
}
----
Then start an RSocket server through the Java RSocket API and plug the
`RSocketMessageHandler` for the responder as follows:
@ -481,6 +642,19 @@ Then start an RSocket server through the Java RSocket API and plug the
@@ -481,6 +642,19 @@ Then start an RSocket server through the Java RSocket API and plug the
{gh-rsocket-extentions}/CompositeMetadata.md[composite] and
@ -516,13 +690,32 @@ you need to share configuration between a client and a server in the same proces
@@ -516,13 +690,32 @@ you need to share configuration between a client and a server in the same proces
Composite metadata works well to combine independent metadata values. However the
requester might not support composite metadata, or may choose not to use it. For this,
@ -636,6 +849,16 @@ map. Here is an example where JSON is used for metadata:
@@ -636,6 +849,16 @@ map. Here is an example where JSON is used for metadata:
When configuring `MetadataExtractor` through `RSocketStrategies`, you can let
`RSocketStrategies.Builder` create the extractor with the configured decoders, and
@ -651,3 +874,15 @@ simply use a callback to customize registrations as follows:
@@ -651,3 +874,15 @@ simply use a callback to customize registrations as follows: