org.springframework.amqp.support.converter.SimpleMessageConverter Java Examples

The following examples show how to use org.springframework.amqp.support.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: RabbitSinkTests.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Test
public void test() throws Exception {
	this.channels.input().send(MessageBuilder.withPayload("foo")
								.setHeader("bar", "baz")
								.setHeader("qux", "fiz")
								.build());
	this.rabbitTemplate.setReceiveTimeout(10000);
	Message received = this.rabbitTemplate.receive("scsapp-testq");
	assertEquals("foo", new String(received.getBody()));
	assertEquals("baz", received.getMessageProperties().getHeaders().get("bar"));
	assertNull(received.getMessageProperties().getHeaders().get("qux"));
	assertEquals(MessageDeliveryMode.PERSISTENT, received.getMessageProperties().getDeliveryMode());
	assertThat(this.rabbitTemplate.getMessageConverter(), instanceOf(SimpleMessageConverter.class));
}
 
Example #2
Source File: RabbitWithRabbitTemplateConfig.java    From java-spring-rabbitmq with Apache License 2.0 4 votes vote down vote up
static RabbitTemplate configureRabbitTemplate(RabbitTemplate rabbitTemplate) {
  SimpleMessageConverter messageConverter = createMessageConverter();
  rabbitTemplate.setMessageConverter(messageConverter);
  rabbitTemplate.setReplyTimeout(RABBIT_TEMPLATE_REPLY_TIMEOUT_MILLIS);
  return rabbitTemplate;
}
 
Example #3
Source File: RabbitWithRabbitTemplateConfig.java    From java-spring-rabbitmq with Apache License 2.0 4 votes vote down vote up
private static SimpleMessageConverter createMessageConverter() {
  SimpleMessageConverter messageConverter = new SimpleMessageConverter();
  messageConverter.setCreateMessageIds(true);
  return messageConverter;
}