org.springframework.messaging.handler.invocation.CompletableFutureReturnValueHandler Java Examples

The following examples show how to use org.springframework.messaging.handler.invocation.CompletableFutureReturnValueHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpAnnotationMethodMessageHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() {
	List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();

	// Single-purpose return value types

	handlers.add(new ListenableFutureReturnValueHandler());
	handlers.add(new CompletableFutureReturnValueHandler());
	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;
}
 
Example #2
Source File: SimpAnnotationMethodMessageHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() {
	List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();

	// Single-purpose return value types

	handlers.add(new ListenableFutureReturnValueHandler());
	handlers.add(new CompletableFutureReturnValueHandler());
	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;
}
 
Example #3
Source File: SimpAnnotationMethodMessageHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected List<? extends HandlerMethodReturnValueHandler> initReturnValueHandlers() {
	List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>();

	// Single-purpose return value types
	handlers.add(new ListenableFutureReturnValueHandler());
	if (completableFuturePresent) {
		handlers.add(new CompletableFutureReturnValueHandler());
	}

	// Annotation-based return value types
	SendToMethodReturnValueHandler sth =
			new SendToMethodReturnValueHandler(this.brokerTemplate, true);
	sth.setHeaderInitializer(this.headerInitializer);
	handlers.add(sth);

	SubscriptionMethodReturnValueHandler sh =
			new SubscriptionMethodReturnValueHandler(this.clientMessagingTemplate);
	sh.setHeaderInitializer(this.headerInitializer);
	handlers.add(sh);

	// custom return value types
	handlers.addAll(getCustomReturnValueHandlers());

	// catch-all
	sth = new SendToMethodReturnValueHandler(this.brokerTemplate, false);
	sth.setHeaderInitializer(this.headerInitializer);
	handlers.add(sth);

	return handlers;
}