Class RSocketFrameTypeMessageCondition
java.lang.Object
org.springframework.messaging.handler.AbstractMessageCondition<RSocketFrameTypeMessageCondition>
org.springframework.messaging.rsocket.annotation.support.RSocketFrameTypeMessageCondition
- All Implemented Interfaces:
MessageCondition<RSocketFrameTypeMessageCondition>
public class RSocketFrameTypeMessageCondition
extends AbstractMessageCondition<RSocketFrameTypeMessageCondition>
A condition to assist with mapping onto handler methods based on the RSocket
frame type. This helps to separate the handling of connection-level frame
types, i.e.
SETUP
and METADATA_PUSH
, from the handling of
stream requests.- Since:
- 5.2
- Author:
- Rossen Stoyanchev
-
Field Summary
Modifier and TypeFieldDescriptionstatic final RSocketFrameTypeMessageCondition
Match connection-level frames "SETUP" or "METADATA_PUSH".static final RSocketFrameTypeMessageCondition
Empty condition that does not match to any RSocket frames (e.g.static final String
The name of the header that contains the RSocket frame type being processed.static final RSocketFrameTypeMessageCondition
Match RSocket frame "REQUEST_CHANNEL".static final RSocketFrameTypeMessageCondition
Match RSocket frames "REQUEST_FNF" or "REQUEST_RESPONSE".static final RSocketFrameTypeMessageCondition
Match RSocket frame "REQUEST_RESPONSE".static final RSocketFrameTypeMessageCondition
Match RSocket frame "REQUEST_STREAM". -
Constructor Summary
ConstructorDescriptionRSocketFrameTypeMessageCondition
(io.rsocket.frame.FrameType... frameType) RSocketFrameTypeMessageCondition
(Collection<io.rsocket.frame.FrameType> frameTypes) -
Method Summary
Modifier and TypeMethodDescriptionDefine the rules for combining this condition with another.int
compareTo
(RSocketFrameTypeMessageCondition other, Message<?> message) Compare this condition to another in the context of a specific message.getCondition
(int cardinalityIn, int cardinalityOut) Return a condition for matching the RSocket request interaction type with that is selected based on the declared request and response cardinality of some handler method.protected Collection<?>
Return the collection of objects the message condition is composed of (e.g.static io.rsocket.frame.FrameType
getFrameType
(Message<?> message) Find the RSocket frame type in the message headers.Set<io.rsocket.frame.FrameType>
getMatchingCondition
(Message<?> message) Check if this condition matches the given Message and returns a potentially new condition with content tailored to the current message.protected String
The notation to use when printing discrete items of content.Methods inherited from class org.springframework.messaging.handler.AbstractMessageCondition
equals, hashCode, toString
-
Field Details
-
FRAME_TYPE_HEADER
The name of the header that contains the RSocket frame type being processed.- See Also:
-
CONNECT_CONDITION
Match connection-level frames "SETUP" or "METADATA_PUSH". -
REQUEST_FNF_OR_RESPONSE_CONDITION
Match RSocket frames "REQUEST_FNF" or "REQUEST_RESPONSE". -
REQUEST_RESPONSE_CONDITION
Match RSocket frame "REQUEST_RESPONSE". -
REQUEST_STREAM_CONDITION
Match RSocket frame "REQUEST_STREAM". -
REQUEST_CHANNEL_CONDITION
Match RSocket frame "REQUEST_CHANNEL". -
EMPTY_CONDITION
Empty condition that does not match to any RSocket frames (e.g. for type-level mappings)
-
-
Constructor Details
-
RSocketFrameTypeMessageCondition
public RSocketFrameTypeMessageCondition(io.rsocket.frame.FrameType... frameType) -
RSocketFrameTypeMessageCondition
-
-
Method Details
-
getFrameTypes
-
getContent
Description copied from class:AbstractMessageCondition
Return the collection of objects the message condition is composed of (e.g. destination patterns), nevernull
.- Specified by:
getContent
in classAbstractMessageCondition<RSocketFrameTypeMessageCondition>
-
getToStringInfix
Description copied from class:AbstractMessageCondition
The notation to use when printing discrete items of content. For example " || " for URL patterns or " && " for param expressions.- Specified by:
getToStringInfix
in classAbstractMessageCondition<RSocketFrameTypeMessageCondition>
-
getFrameType
Find the RSocket frame type in the message headers.- Parameters:
message
- the current message- Returns:
- the frame type or
null
if not found
-
combine
Description copied from interface:MessageCondition
Define the rules for combining this condition with another. For example combining type- and method-level conditions.- Parameters:
other
- the condition to combine with- Returns:
- the resulting message condition
-
getMatchingCondition
Description copied from interface:MessageCondition
Check if this condition matches the given Message and returns a potentially new condition with content tailored to the current message. For example a condition with destination patterns might return a new condition with sorted, matching patterns only.- Returns:
- a condition instance in case of a match; or
null
if there is no match.
-
compareTo
Description copied from interface:MessageCondition
Compare this condition to another in the context of a specific message. It is assumed both instances have been obtained viaMessageCondition.getMatchingCondition(Message)
to ensure they have content relevant to current message only. -
getCondition
Return a condition for matching the RSocket request interaction type with that is selected based on the declared request and response cardinality of some handler method.The table below shows the selections made:
Request Cardinality Response Cardinality Interaction Types 0,1 0 Fire-And-Forget, Request-Response 0,1 1 Request-Response 0,1 2 Request-Stream 2 Any Request-Channel - Parameters:
cardinalityIn
- -- the request cardinality: 1 for a single payload, 2 for many payloads, and 0 if input is not handled.cardinalityOut
- -- the response cardinality: 0 for no output payloads, 1 for a single payload, and 2 for many payloads.- Returns:
- a condition to use for matching the interaction type
- Since:
- 5.2.2
-