Class ServerRSocketMessageHandler
java.lang.Object
org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler<CompositeMessageCondition>
org.springframework.messaging.handler.annotation.reactive.MessageMappingMessageHandler
org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler
org.springframework.integration.rsocket.ServerRSocketMessageHandler
- All Implemented Interfaces:
Aware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ApplicationEventPublisherAware
,EmbeddedValueResolverAware
,ReactiveMessageHandler
public class ServerRSocketMessageHandler
extends RSocketMessageHandler
implements ApplicationEventPublisherAware
An
IntegrationRSocketMessageHandler
extension for RSocket service side.
In a plain Spring Integration application instances of this class are created by the
ServerRSocketConnector
internally and a new RSocket server is started over there.
When an existing RSocket server is in use, an instance of this class has to be
provided as a RSocketMessageHandler.responder()
into that server and a ServerRSocketConnector
should accept the same instance as a delegate.
With a messageMappingCompatible
option this class also handles
MessageMapping
methods,
covering both Spring Integration and standard
RSocketMessageHandler
functionality.
- Since:
- 5.2.1
- Author:
- Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler
logger
-
Constructor Summary
ConstructorDescriptionCreate an service side RSocket message handler instance for delegating toIntegrationRSocketEndpoint
beans and collectRSocketRequester
s from client connections.ServerRSocketMessageHandler
(boolean messageMappingCompatible) Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpoint
beans and collectRSocketRequester
s from client connections. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEndpoint
(IntegrationRSocketEndpoint endpoint) boolean
Obtain a connectedRSocketRequester
mapped by provided key or null.Get connectedRSocketRequester
s mapped by the keys from the connect messages.protected List<? extends HandlerMethodArgumentResolver>
protected List<? extends HandlerMethodReturnValueHandler>
void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setClientRSocketKeyStrategy
(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure aBiFunction
to extract a key for mapping connectedRSocketRequester
s.Methods inherited from class org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler
afterPropertiesSet, extendMapping, getCondition, getDefaultDataMimeType, getDefaultMetadataMimeType, getEncoders, getMetadataExtractor, getRSocketStrategies, handleNoMatch, responder, responder, setDecoders, setDefaultDataMimeType, setDefaultMetadataMimeType, setEncoders, setMetadataExtractor, setReactiveAdapterRegistry, setRouteMatcher, setRSocketStrategies
Methods inherited from class org.springframework.messaging.handler.annotation.reactive.MessageMappingMessageHandler
createExceptionMethodResolverFor, getConversionService, getDecoders, getDestination, getDirectLookupMappings, getMappingComparator, getMappingForMethod, getMatchingMapping, getRouteMatcher, getValidator, handleMatch, obtainRouteMatcher, processDestinations, registerMessagingAdvice, setConversionService, setEmbeddedValueResolver, setValidator
Methods inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler
detectHandlerMethods, getApplicationContext, getArgumentResolverConfigurer, getArgumentResolvers, getBeanName, getDestinationLookup, getHandlerMethods, getHandlerPredicate, getReactiveAdapterRegistry, getReturnValueHandlerConfigurer, handleMessage, registerExceptionHandlerAdvice, registerHandlerMethod, setApplicationContext, setArgumentResolverConfigurer, setBeanName, setHandlerPredicate, setHandlers, setReturnValueHandlerConfigurer
-
Field Details
-
messageMappingCompatible
protected final boolean messageMappingCompatible
-
-
Constructor Details
-
ServerRSocketMessageHandler
public ServerRSocketMessageHandler()Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpoint
beans and collectRSocketRequester
s from client connections. -
ServerRSocketMessageHandler
public ServerRSocketMessageHandler(boolean messageMappingCompatible) Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpoint
beans and collectRSocketRequester
s from client connections. WhenmessageMappingCompatible == true
, this class also handlesMessageMapping
methods as it is done by the standardRSocketMessageHandler
.- Parameters:
messageMappingCompatible
- whether handle alsoMessageMapping
.
-
-
Method Details
-
setClientRSocketKeyStrategy
public void setClientRSocketKeyStrategy(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure aBiFunction
to extract a key for mapping connectedRSocketRequester
s. Defaults to thedestination
a client is connected.- Parameters:
clientRSocketKeyStrategy
- theBiFunction
to use.
-
getClientRSocketRequesters
Get connectedRSocketRequester
s mapped by the keys from the connect messages. -
getClientRSocketRequester
Obtain a connectedRSocketRequester
mapped by provided key or null.- Parameters:
key
- the key for mappedRSocketRequester
if any.- Returns:
- the mapped
RSocketRequester
or null.
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
detectEndpoints
public boolean detectEndpoints() -
addEndpoint
-
initArgumentResolvers
- Overrides:
initArgumentResolvers
in classMessageMappingMessageHandler
-
initReturnValueHandlers
- Overrides:
initReturnValueHandlers
in classRSocketMessageHandler
-