Class RSocketServiceProxyFactory
java.lang.Object
org.springframework.messaging.rsocket.service.RSocketServiceProxyFactory
- All Implemented Interfaces:
Aware,InitializingBean,EmbeddedValueResolverAware
public final class RSocketServiceProxyFactory
extends Object
implements InitializingBean, EmbeddedValueResolverAware
Factory for creating a client proxy given an RSocket service interface with
@RSocketExchange methods.
This class is intended to be declared as a bean in Spring configuration.
- Since:
- 6.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionRSocketServiceProxyFactory(RSocketRequester rsocketRequester) Create an instance with the underlying RSocketRequester to perform requests with. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a custom argument resolver, invoked ahead of default resolvers.voidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.<S> ScreateClient(Class<S> serviceType) Return a proxy that implements the given RSocket service interface to perform RSocket requests and retrieve responses through the configuredRSocketRequester.voidsetBlockTimeout(Duration blockTimeout) Configure how long to wait for a response for an RSocket service method with a synchronous (blocking) method signature.voidSet the custom argument resolvers to use, ahead of default resolvers.voidsetEmbeddedValueResolver(StringValueResolver resolver) Set the StringValueResolver to use for resolving placeholders and expressions inRSocketExchange.value().voidSet theReactiveAdapterRegistryto use to support different asynchronous types for RSocket service method return values.
-
Constructor Details
-
RSocketServiceProxyFactory
Create an instance with the underlying RSocketRequester to perform requests with.- Parameters:
rsocketRequester- the requester to use
-
-
Method Details
-
addCustomArgumentResolver
Register a custom argument resolver, invoked ahead of default resolvers.- Parameters:
resolver- the resolver to add
-
setCustomArgumentResolvers
Set the custom argument resolvers to use, ahead of default resolvers.- Parameters:
resolvers- the resolvers to use
-
setEmbeddedValueResolver
Set the StringValueResolver to use for resolving placeholders and expressions inRSocketExchange.value().- Specified by:
setEmbeddedValueResolverin interfaceEmbeddedValueResolverAware- Parameters:
resolver- the resolver to use
-
setReactiveAdapterRegistry
Set theReactiveAdapterRegistryto use to support different asynchronous types for RSocket service method return values.By default this is
ReactiveAdapterRegistry.getSharedInstance(). -
setBlockTimeout
Configure how long to wait for a response for an RSocket service method with a synchronous (blocking) method signature.By default this is 5 seconds.
- Parameters:
blockTimeout- the timeout value
-
afterPropertiesSet
Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
-
createClient
Return a proxy that implements the given RSocket service interface to perform RSocket requests and retrieve responses through the configuredRSocketRequester.- Type Parameters:
S- the RSocket service type- Parameters:
serviceType- the RSocket service to create a proxy for- Returns:
- the created proxy
-