Search in sources :

Example 1 with ReactiveReturnValueHandler

use of org.springframework.messaging.handler.invocation.ReactiveReturnValueHandler in project spring-framework by spring-projects.

the class SimpAnnotationMethodMessageHandler method initReturnValueHandlers.

@Override
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() {
    List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
    // Single-purpose return value types
    handlers.add(new ListenableFutureReturnValueHandler());
    handlers.add(new CompletableFutureReturnValueHandler());
    if (reactorPresent) {
        handlers.add(new ReactiveReturnValueHandler());
    }
    // Annotation-based return value types
    SendToMethodReturnValueHandler sendToHandler = new SendToMethodReturnValueHandler(this.brokerTemplate, true);
    sendToHandler.setHeaderInitializer(this.headerInitializer);
    handlers.add(sendToHandler);
    SubscriptionMethodReturnValueHandler subscriptionHandler = new SubscriptionMethodReturnValueHandler(this.clientMessagingTemplate);
    subscriptionHandler.setHeaderInitializer(this.headerInitializer);
    handlers.add(subscriptionHandler);
    // Custom return value types
    handlers.addAll(getCustomReturnValueHandlers());
    // Catch-all
    sendToHandler = new SendToMethodReturnValueHandler(this.brokerTemplate, false);
    sendToHandler.setHeaderInitializer(this.headerInitializer);
    handlers.add(sendToHandler);
    return handlers;
}
Also used : HandlerMethodReturnValueHandler(org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler) ArrayList(java.util.ArrayList) ListenableFutureReturnValueHandler(org.springframework.messaging.handler.invocation.ListenableFutureReturnValueHandler) ReactiveReturnValueHandler(org.springframework.messaging.handler.invocation.ReactiveReturnValueHandler) CompletableFutureReturnValueHandler(org.springframework.messaging.handler.invocation.CompletableFutureReturnValueHandler)

Aggregations

ArrayList (java.util.ArrayList)1 CompletableFutureReturnValueHandler (org.springframework.messaging.handler.invocation.CompletableFutureReturnValueHandler)1 HandlerMethodReturnValueHandler (org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler)1 ListenableFutureReturnValueHandler (org.springframework.messaging.handler.invocation.ListenableFutureReturnValueHandler)1 ReactiveReturnValueHandler (org.springframework.messaging.handler.invocation.ReactiveReturnValueHandler)1