I'm using Spring AMQP to send message from one microservice to other one and get response.
I can send message and receive content with this code part:
public void sendAmqpCoreMessage(Message message) throws JsonProcessingException {
List<MyCustomType> response = rabbitTemplate.convertSendAndReceiveAsType("jms.durable.queues", this.queue.getName(), message, new ParameterizedTypeReference<List<MyCustomType>>() {
});
logger.info("Response: {}", new ObjectMapper().writeValueAsString(response));
}
But instead of getting only message content, I need the whole Message object because I'm using some headers which stay in messageProperties of response which's type is Message.
How can I get Message object as response?