public class ServerRSocketMessageHandler extends RSocketMessageHandler implements ApplicationEventPublisherAware
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.
Modifier and Type | Class and Description |
---|---|
protected static class |
org.springframework.integration.rsocket.IntegrationRSocketMessageHandler.IntegrationRSocketPayloadReturnValueHandler |
protected static class |
org.springframework.integration.rsocket.IntegrationRSocketMessageHandler.MessageHandlerMethodArgumentResolver |
Modifier and Type | Field and Description |
---|---|
protected boolean |
messageMappingCompatible |
logger
Constructor and Description |
---|
ServerRSocketMessageHandler()
Create an service side RSocket message handler instance for delegating
to
IntegrationRSocketEndpoint beans and collect RSocketRequester s
from client connections. |
ServerRSocketMessageHandler(boolean messageMappingCompatible)
Create an service side RSocket message handler instance for delegating
to
IntegrationRSocketEndpoint beans and collect RSocketRequester s
from client connections. |
Modifier and Type | Method and Description |
---|---|
void |
addEndpoint(IntegrationRSocketEndpoint endpoint) |
boolean |
detectEndpoints() |
RSocketRequester |
getClientRSocketRequester(Object key)
Obtain a connected
RSocketRequester mapped by provided key or null. |
Map<Object,RSocketRequester> |
getClientRSocketRequesters()
Get connected
RSocketRequester s mapped by the keys from the connect messages. |
protected List<? extends HandlerMethodArgumentResolver> |
initArgumentResolvers() |
protected List<? extends HandlerMethodReturnValueHandler> |
initReturnValueHandlers() |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setClientRSocketKeyStrategy(java.util.function.BiFunction<Map<String,Object>,DataBuffer,Object> clientRSocketKeyStrategy)
Configure a
BiFunction to extract a key for mapping connected RSocketRequester s. |
afterPropertiesSet, extendMapping, getCondition, getDefaultDataMimeType, getDefaultMetadataMimeType, getEncoders, getMetadataExtractor, getRSocketStrategies, handleNoMatch, responder, responder, setDecoders, setDefaultDataMimeType, setDefaultMetadataMimeType, setEncoders, setMetadataExtractor, setReactiveAdapterRegistry, setRouteMatcher, setRSocketStrategies
createExceptionMethodResolverFor, getConversionService, getDecoders, getDestination, getDirectLookupMappings, getMappingComparator, getMappingForMethod, getMatchingMapping, getRouteMatcher, getValidator, handleMatch, obtainRouteMatcher, processDestinations, setConversionService, setEmbeddedValueResolver, setValidator
detectHandlerMethods, getApplicationContext, getArgumentResolverConfigurer, getArgumentResolvers, getBeanName, getDestinationLookup, getHandlerMethods, getHandlerPredicate, getReactiveAdapterRegistry, getReturnValueHandlerConfigurer, handleMessage, registerExceptionHandlerAdvice, registerHandlerMethod, setApplicationContext, setArgumentResolverConfigurer, setBeanName, setHandlerPredicate, setHandlers, setReturnValueHandlerConfigurer
public ServerRSocketMessageHandler()
IntegrationRSocketEndpoint
beans and collect RSocketRequester
s
from client connections.public ServerRSocketMessageHandler(boolean messageMappingCompatible)
IntegrationRSocketEndpoint
beans and collect RSocketRequester
s
from client connections.
When messageMappingCompatible == true
, this class also handles
MessageMapping
methods
as it is done by the standard
RSocketMessageHandler
.messageMappingCompatible
- whether handle also
MessageMapping
.public void setClientRSocketKeyStrategy(java.util.function.BiFunction<Map<String,Object>,DataBuffer,Object> clientRSocketKeyStrategy)
BiFunction
to extract a key for mapping connected RSocketRequester
s.
Defaults to the destination
a client is connected.clientRSocketKeyStrategy
- the BiFunction
to use.public Map<Object,RSocketRequester> getClientRSocketRequesters()
RSocketRequester
s mapped by the keys from the connect messages.@Nullable public RSocketRequester getClientRSocketRequester(Object key)
RSocketRequester
mapped by provided key or null.key
- the key for mapped RSocketRequester
if any.RSocketRequester
or null.public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface ApplicationEventPublisherAware
public boolean detectEndpoints()
public void addEndpoint(IntegrationRSocketEndpoint endpoint)
protected List<? extends HandlerMethodArgumentResolver> initArgumentResolvers()
initArgumentResolvers
in class MessageMappingMessageHandler
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers()
initReturnValueHandlers
in class RSocketMessageHandler