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 SummaryFieldsFields inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandlerlogger
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an service side RSocket message handler instance for delegating toIntegrationRSocketEndpointbeans and collectRSocketRequesters from client connections.ServerRSocketMessageHandler(boolean messageMappingCompatible) Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpointbeans and collectRSocketRequesters from client connections.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEndpoint(IntegrationRSocketEndpoint endpoint) boolean@Nullable RSocketRequesterObtain a connectedRSocketRequestermapped by provided key or null.Get connectedRSocketRequesters mapped by the keys from the connect messages.protected List<? extends HandlerMethodArgumentResolver> protected List<? extends HandlerMethodReturnValueHandler> voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetClientRSocketKeyStrategy(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure aBiFunctionto extract a key for mapping connectedRSocketRequesters.Methods inherited from class org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandlerafterPropertiesSet, extendMapping, getCondition, getDefaultDataMimeType, getDefaultMetadataMimeType, getEncoders, getMetadataExtractor, getRSocketStrategies, handleNoMatch, responder, responder, setDecoders, setDefaultDataMimeType, setDefaultMetadataMimeType, setEncoders, setMetadataExtractor, setReactiveAdapterRegistry, setRouteMatcher, setRSocketStrategiesMethods inherited from class org.springframework.messaging.handler.annotation.reactive.MessageMappingMessageHandlercreateExceptionMethodResolverFor, getConversionService, getDecoders, getDestination, getDirectLookupMappings, getMappingComparator, getMappingForMethod, getMatchingMapping, getRouteMatcher, getValidator, handleMatch, obtainRouteMatcher, processDestinations, registerMessagingAdvice, setConversionService, setEmbeddedValueResolver, setValidatorMethods inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandlerdetectHandlerMethods, getApplicationContext, getArgumentResolverConfigurer, getArgumentResolvers, getBeanName, getDestinationLookup, getHandlerMethods, getHandlerPredicate, getReactiveAdapterRegistry, getReturnValueHandlerConfigurer, handleMessage, registerExceptionHandlerAdvice, registerHandlerMethod, setApplicationContext, setArgumentResolverConfigurer, setBeanName, setHandlerPredicate, setHandlers, setReturnValueHandlerConfigurer
- 
Field Details- 
messageMappingCompatibleprotected final boolean messageMappingCompatible
 
- 
- 
Constructor Details- 
ServerRSocketMessageHandlerpublic ServerRSocketMessageHandler()Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpointbeans and collectRSocketRequesters from client connections.
- 
ServerRSocketMessageHandlerpublic ServerRSocketMessageHandler(boolean messageMappingCompatible) Create an service side RSocket message handler instance for delegating toIntegrationRSocketEndpointbeans and collectRSocketRequesters from client connections. WhenmessageMappingCompatible == true, this class also handlesMessageMappingmethods as it is done by the standardRSocketMessageHandler.- Parameters:
- messageMappingCompatible- whether handle also- MessageMapping.
 
 
- 
- 
Method Details- 
setClientRSocketKeyStrategypublic void setClientRSocketKeyStrategy(BiFunction<Map<String, Object>, DataBuffer, Object> clientRSocketKeyStrategy) Configure aBiFunctionto extract a key for mapping connectedRSocketRequesters. Defaults to thedestinationa client is connected.- Parameters:
- clientRSocketKeyStrategy- the- BiFunctionto use.
 
- 
getClientRSocketRequestersGet connectedRSocketRequesters mapped by the keys from the connect messages.- Returns:
- the map of connected RSocketRequesters.
- See Also:
 
- 
getClientRSocketRequesterObtain a connectedRSocketRequestermapped by provided key or null.- Parameters:
- key- the key for mapped- RSocketRequesterif any.
- Returns:
- the mapped RSocketRequesteror null.
 
- 
setApplicationEventPublisher- Specified by:
- setApplicationEventPublisherin interface- ApplicationEventPublisherAware
 
- 
detectEndpointspublic boolean detectEndpoints()
- 
addEndpoint
- 
initArgumentResolvers- Overrides:
- initArgumentResolversin class- MessageMappingMessageHandler
 
- 
initReturnValueHandlers- Overrides:
- initReturnValueHandlersin class- RSocketMessageHandler
 
 
-