org.springframework.messaging.core.AbstractMessageSendingTemplate Java Examples

The following examples show how to use org.springframework.messaging.core.AbstractMessageSendingTemplate. 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: MessagingMessageListenerAdapter.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
protected Object preProcessResponse(Object result) {
	MethodParameter returnType = getHandlerMethod().getReturnType();
	if (result instanceof Message) {
		return MessageBuilder.fromMessage((Message<?>) result)
				.setHeader(AbstractMessageSendingTemplate.CONVERSION_HINT_HEADER, returnType).build();
	}
	return MessageBuilder.withPayload(result).setHeader(
			AbstractMessageSendingTemplate.CONVERSION_HINT_HEADER, returnType).build();
}
 
Example #2
Source File: MessagingMessageListenerAdapter.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected Object preProcessResponse(Object result) {
	MethodParameter returnType = getHandlerMethod().getReturnType();
	if (result instanceof Message) {
		return MessageBuilder.fromMessage((Message<?>) result)
				.setHeader(AbstractMessageSendingTemplate.CONVERSION_HINT_HEADER, returnType).build();
	}
	return MessageBuilder.withPayload(result).setHeader(
			AbstractMessageSendingTemplate.CONVERSION_HINT_HEADER, returnType).build();
}
 
Example #3
Source File: SimpAnnotationMethodMessageHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Configure a {@link MessageConverter} to use to convert the payload of a message from
 * its serialized form with a specific MIME type to an Object matching the target method
 * parameter. The converter is also used when sending a message to the message broker.
 * @see CompositeMessageConverter
 */
public void setMessageConverter(MessageConverter converter) {
	this.messageConverter = converter;
	if (converter != null) {
		((AbstractMessageSendingTemplate<?>) this.clientMessagingTemplate).setMessageConverter(converter);
	}
}
 
Example #4
Source File: SimpAnnotationMethodMessageHandler.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Configure a {@link MessageConverter} to use to convert the payload of a message from
 * its serialized form with a specific MIME type to an Object matching the target method
 * parameter. The converter is also used when sending a message to the message broker.
 * @see CompositeMessageConverter
 */
public void setMessageConverter(MessageConverter converter) {
	this.messageConverter = converter;
	((AbstractMessageSendingTemplate<?>) this.clientMessagingTemplate).setMessageConverter(converter);
}
 
Example #5
Source File: SimpAnnotationMethodMessageHandler.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Configure a {@link MessageConverter} to use to convert the payload of a message from
 * its serialized form with a specific MIME type to an Object matching the target method
 * parameter. The converter is also used when sending a message to the message broker.
 * @see CompositeMessageConverter
 */
public void setMessageConverter(MessageConverter converter) {
	this.messageConverter = converter;
	((AbstractMessageSendingTemplate<?>) this.clientMessagingTemplate).setMessageConverter(converter);
}