The Spring Framework lets you define an RSocket service as a Java interface with annotated
methods for RSocket exchanges. You can then generate a proxy that implements this interface
and performs the exchanges. This helps to simplify RSocket remote access by wrapping the
use of the underlying xref:rsocket.adoc#rsocket-requester[RSocketRequester].
The Spring Framework lets you define an RSocket service as a Java interface with
`@RSocketExchange` methods. You can pass such an interface to `RSocketServiceProxyFactory`
to create a proxy which performs requests through an
xref:rsocket.adoc#rsocket-requester[RSocketRequester]. You can also implement the
interface as a responder that handles requests.
One, declare an interface with `@RSocketExchange` methods:
Start by creating the interface with `@RSocketExchange` methods:
[source,java,indent=0,subs="verbatim,quotes"]
----
@ -1071,7 +1082,7 @@ One, declare an interface with `@RSocketExchange` methods:
@@ -1071,7 +1082,7 @@ One, declare an interface with `@RSocketExchange` methods:
}
----
Two, create a proxy that will perform the declared RSocket exchanges:
Now you can create a proxy that performs requests when methods are called:
[source,java,indent=0,subs="verbatim,quotes"]
----
@ -1081,8 +1092,9 @@ Two, create a proxy that will perform the declared RSocket exchanges:
@@ -1081,8 +1092,9 @@ Two, create a proxy that will perform the declared RSocket exchanges:
RepositoryService service = factory.createClient(RadarService.class);
----
NOTE: Apart from RSocket interface services, `@RSocketExchange` can also
be used to create xref:rsocket.adoc#rsocket-annot-rsocketexchange[annotated responders].
You can also implement the interface to handle requests as a responder.
See xref:rsocket.adoc#rsocket-annot-rsocketexchange[Annotated Responders].