Search in sources :

Example 1 with ConnectMapping

use of org.springframework.messaging.rsocket.annotation.ConnectMapping in project spring-framework by spring-projects.

the class RSocketMessageHandler method getCondition.

@Override
@Nullable
protected CompositeMessageCondition getCondition(AnnotatedElement element) {
    MessageMapping ann1 = AnnotatedElementUtils.findMergedAnnotation(element, MessageMapping.class);
    if (ann1 != null && ann1.value().length > 0) {
        return new CompositeMessageCondition(RSocketFrameTypeMessageCondition.EMPTY_CONDITION, new DestinationPatternsMessageCondition(processDestinations(ann1.value()), obtainRouteMatcher()));
    }
    ConnectMapping ann2 = AnnotatedElementUtils.findMergedAnnotation(element, ConnectMapping.class);
    if (ann2 != null) {
        String[] patterns = processDestinations(ann2.value());
        return new CompositeMessageCondition(RSocketFrameTypeMessageCondition.CONNECT_CONDITION, new DestinationPatternsMessageCondition(patterns, obtainRouteMatcher()));
    }
    return null;
}
Also used : CompositeMessageCondition(org.springframework.messaging.handler.CompositeMessageCondition) DestinationPatternsMessageCondition(org.springframework.messaging.handler.DestinationPatternsMessageCondition) ConnectMapping(org.springframework.messaging.rsocket.annotation.ConnectMapping) MessageMapping(org.springframework.messaging.handler.annotation.MessageMapping) Nullable(org.springframework.lang.Nullable)

Aggregations

Nullable (org.springframework.lang.Nullable)1 CompositeMessageCondition (org.springframework.messaging.handler.CompositeMessageCondition)1 DestinationPatternsMessageCondition (org.springframework.messaging.handler.DestinationPatternsMessageCondition)1 MessageMapping (org.springframework.messaging.handler.annotation.MessageMapping)1 ConnectMapping (org.springframework.messaging.rsocket.annotation.ConnectMapping)1