use of org.springframework.amqp.rabbit.support.DefaultMessagePropertiesConverter in project spring-integration by spring-projects.
the class JsonConverterCompatibilityTests method testInbound.
@Test
public void testInbound() {
@SuppressWarnings("unchecked") final Message<String> out = (Message<String>) new ObjectToJsonTransformer().transform(new GenericMessage<Foo>(new Foo()));
MessageProperties messageProperties = new MessageProperties();
DefaultAmqpHeaderMapper.outboundMapper().fromHeadersToRequest(out.getHeaders(), messageProperties);
final BasicProperties props = new DefaultMessagePropertiesConverter().fromMessageProperties(messageProperties, "UTF-8");
this.rabbitTemplate.execute(channel -> {
channel.basicPublish("", JSON_TESTQ, props, out.getPayload().getBytes());
return null;
});
Object received = this.rabbitTemplate.receiveAndConvert(JSON_TESTQ);
assertThat(received, instanceOf(Foo.class));
}
Aggregations