org.springframework.messaging.converter.SimpleMessageConverter Java Examples

The following examples show how to use org.springframework.messaging.converter.SimpleMessageConverter. 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: QueueMessagingTemplateTest.java    From spring-cloud-aws with Apache License 2.0 6 votes vote down vote up
@Test
void instantiation_withConverter_shouldAddItToTheCompositeConverter() {
	// Arrange
	SimpleMessageConverter simpleMessageConverter = new SimpleMessageConverter();

	// Act
	QueueMessagingTemplate queueMessagingTemplate = new QueueMessagingTemplate(
			createAmazonSqs(), (ResourceIdResolver) null, simpleMessageConverter);

	// Assert
	assertThat(
			((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter())
					.getConverters()).hasSize(2);
	assertThat(
			((CompositeMessageConverter) queueMessagingTemplate.getMessageConverter())
					.getConverters().get(1)).isEqualTo(simpleMessageConverter);
}
 
Example #2
Source File: MethodMessageHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected List<? extends HandlerMethodArgumentResolver> initArgumentResolvers() {
	List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
	resolvers.add(new MessageMethodArgumentResolver(new SimpleMessageConverter()));
	resolvers.addAll(getCustomArgumentResolvers());
	return resolvers;
}
 
Example #3
Source File: MethodMessageHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected List<? extends HandlerMethodArgumentResolver> initArgumentResolvers() {
	List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
	resolvers.add(new MessageMethodArgumentResolver(new SimpleMessageConverter()));
	resolvers.addAll(getCustomArgumentResolvers());
	return resolvers;
}
 
Example #4
Source File: QueueMessageHandler.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
private CompositeMessageConverter createPayloadArgumentCompositeConverter() {
	List<MessageConverter> payloadArgumentConverters = new ArrayList<>(
			this.messageConverters);

	ObjectMessageConverter objectMessageConverter = new ObjectMessageConverter();
	objectMessageConverter.setStrictContentTypeMatch(true);
	payloadArgumentConverters.add(objectMessageConverter);

	payloadArgumentConverters.add(new SimpleMessageConverter());

	return new CompositeMessageConverter(payloadArgumentConverters);
}