MessageMappingMessageHandler to handle RSocket
requests with @MessageMapping and
@ConnectMapping methods, also supporting use of
@RSocketExchange.
For server scenarios this class can be declared as a bean in Spring
configuration and that would detect @MessageMapping methods in
@Controller beans. What beans are checked can be changed through a
handlerPredicate. Given an instance
of this class, you can then use responder() to obtain a
SocketAcceptor adapter to register with the
io..
For a client, possibly in the same process as a server, consider using the
static factory method responder(RSocketStrategies, Object. to
obtain a client responder to be registered via
RSocketRequester..
For @MessageMapping and @RSocketExchange methods,
this class automatically determines the RSocket interaction type
based on the input and output cardinality of the method. See the
"Annotated Responders" section of the Spring Framework reference for more details.
| Modifier and Type | Field and Description |
|---|---|
| private MimeType | |
| private MimeType | |
| private final List | |
| private RSocketStrategies |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| private MessagingRSocket | |
| protected CompositeMessageCondition | extendMapping(CompositeMessageCondition
the mapping to be added composite, HandlerMethod the target handler for the mapping handler)Overrides org. This method is invoked just before mappings are added. |
| private int | |
| protected CompositeMessageCondition | getCondition(AnnotatedElement
the element to check element)Overrides org. Determine the mapping condition for the given annotated element. |
| public MimeType | |
| public MimeType | |
| public List | |
| public MetadataExtractor | |
| public RSocketStrategies | |
| protected void | handleNoMatch(RouteMatcher.
the destination destination,the message message)Overrides org. Invoked when no matching handler is found. |
| protected List | |
| private boolean | |
| public SocketAcceptor | responder()
Return an RSocket |
| public static SocketAcceptor | Returns: a configurer that may be passed intoorg.the strategies to set on the created
strategies, Object... RSocketMessageHandlera list of Objects and/or Classes with annotated
handler methods; used to call candidateHandlers)setHandlers(List) with
on the created RSocketMessageHandlerStatic factory method to create an RSocket |
| public void | setDecoders(List<? extends Decoder<?>> decoders)
Overrides org. Configure the decoders to use for incoming payloads. |
| public void | setDefaultDataMimeType(MimeType
the MimeType to use mimeType)Configure the default content type to use for data payloads if the
|
| public void | setDefaultMetadataMimeType(MimeType
the MimeType to use mimeType)Configure the default |
| public void | setEncoders(List<? extends Encoder<?>> encoders)
Configure the encoders to use for encoding handler method return values. |
| public void | setMetadataExtractor(MetadataExtractor
the extractor to use extractor)Configure a |
| public void | setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
Configure the registry for adapting various reactive types. |
| public void | setRouteMatcher(RouteMatcher routeMatcher)
Set the |
| public void | setRSocketStrategies(RSocketStrategies rsocketStrategies)
Configure this handler through an |
| defaultDataMimeType | back to summary |
|---|---|
| private MimeType defaultDataMimeType
| |
| defaultMetadataMimeType | back to summary |
|---|---|
| private MimeType defaultMetadataMimeType | |
| encoders | back to summary |
|---|---|
| private final List<Encoder<?>> encoders | |
| strategies | back to summary |
|---|---|
| private RSocketStrategies strategies | |
| RSocketMessageHandler | back to summary |
|---|---|
| public RSocketMessageHandler() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| createResponder | back to summary |
|---|---|
| private MessagingRSocket createResponder(ConnectionSetupPayload setupPayload, RSocket rsocket) | |
| extendMapping | back to summary |
|---|---|
| protected CompositeMessageCondition extendMapping(CompositeMessageCondition composite, HandlerMethod handler) Overrides org. Doc from org. This method is invoked just before mappings are added. It allows
subclasses to update the mapping with the By default this method returns the mapping that is passed in.
| |
| getCardinality | back to summary |
|---|---|
| private int getCardinality(MethodParameter parameter) | |
| getCondition | back to summary |
|---|---|
| protected CompositeMessageCondition getCondition(AnnotatedElement element) Overrides org. Doc from org. Determine the mapping condition for the given annotated element.
| |
| getDefaultDataMimeType | back to summary |
|---|---|
| public MimeType getDefaultDataMimeType() Return the configured
| |
| getDefaultMetadataMimeType | back to summary |
|---|---|
| public MimeType getDefaultMetadataMimeType() Return the configured
| |
| getEncoders | back to summary |
|---|---|
| public List Return the configured | |
| getMetadataExtractor | back to summary |
|---|---|
| public MetadataExtractor getMetadataExtractor() Return the configured | |
| getRSocketStrategies | back to summary |
|---|---|
| public RSocketStrategies getRSocketStrategies() Return the | |
| handleNoMatch | back to summary |
|---|---|
| protected void handleNoMatch(RouteMatcher. Overrides org. Doc from org. Invoked when no matching handler is found.
| |
| initReturnValueHandlers | back to summary |
|---|---|
| protected List Return the list of return value handlers to use. Subclasses should also take into account custom return value types configured
via
| |
| isDataMimeTypeSupported | back to summary |
|---|---|
| private boolean isDataMimeTypeSupported(MimeType dataMimeType) | |
| responder | back to summary |
|---|---|
| public SocketAcceptor responder() Return an RSocket The initial Subsequent requests on the connection can be handled with
| |
| responder | back to summary |
|---|---|
| public static SocketAcceptor responder(RSocketStrategies strategies, Object... candidateHandlers) Static factory method to create an RSocket RSocketMessageHandler handler = new RSocketMessageHandler(); handler.setHandlers(handlers); handler.setRSocketStrategies(strategies); handler.afterPropertiesSet(); SocketAcceptor acceptor = handler.responder(); This is intended for programmatic creation and registration of a client-side responder. For example:
SocketAcceptor responder =
RSocketMessageHandler.responder(strategies, new ClientHandler());
RSocketRequester.builder()
.rsocketConnector(connector -> connector.acceptor(responder))
.connectTcp("localhost", server.address().getPort());
Note that the given handlers do not need to have any stereotype
annotations such as
| |
| setDecoders | back to summary |
|---|---|
| public void setDecoders(List<? extends Decoder<?>> decoders) Overrides org. Doc from org. Configure the decoders to use for incoming payloads. When By default this is set to the
defaults
from
| |
| setDefaultDataMimeType | back to summary |
|---|---|
| public void setDefaultDataMimeType(MimeType mimeType) Configure the default content type to use for data payloads if the
By default this is not set.
| |
| setDefaultMetadataMimeType | back to summary |
|---|---|
| public void setDefaultMetadataMimeType(MimeType mimeType) Configure the default By default this is set to
| |
| setEncoders | back to summary |
|---|---|
| public void setEncoders(List<? extends Encoder<?>> encoders) Configure the encoders to use for encoding handler method return values. When By default this is set to the
defaults
from | |
| setMetadataExtractor | back to summary |
|---|---|
| public void setMetadataExtractor(MetadataExtractor extractor) Configure a When By default this is set to the
| |
| setReactiveAdapterRegistry | back to summary |
|---|---|
| public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) Configure the registry for adapting various reactive types. When By default this is set to the
| |
| setRouteMatcher | back to summary |
|---|---|
| public void setRouteMatcher(RouteMatcher routeMatcher) Set the By default, When By default this is set to the
defaults
from
| |
| setRSocketStrategies | back to summary |
|---|---|
| public void setRSocketStrategies(RSocketStrategies rsocketStrategies) Configure this handler through an When this property is set, in turn it sets the following:
By default this is set to | |