ConnectionFactoryUtils.registerDeliveryTag(
RabbitTemplate.this.getConnectionFactory(),
channel, deliveryTag);
}
Message receiveMessage = RabbitTemplate.this
.buildMessageFromResponse(response);
Object receive = receiveMessage;
if (!(ReceiveAndReplyMessageCallback.class
.isAssignableFrom(callback.getClass()))) {
receive = RabbitTemplate.this
.getRequiredMessageConverter().fromMessage(
receiveMessage);
}
S reply;
try {
reply = callback.handle((R) receive);
} catch (ClassCastException e) {
StackTraceElement[] trace = e.getStackTrace();
if (trace[0].getMethodName().equals("handle")
&& trace[1].getFileName().equals(
"RabbitTemplate.java")) {
throw new IllegalArgumentException(
"ReceiveAndReplyCallback '"
+ callback
+ "' can't handle received object '"
+ receive + "'", e);
} else {
throw e;
}
}
if (reply != null) {
Address replyTo = replyToAddressCallback
.getReplyToAddress(receiveMessage, reply);
Message replyMessage = RabbitTemplate.this
.convertMessageIfNecessary(reply);
MessageProperties receiveMessageProperties = receiveMessage
.getMessageProperties();
MessageProperties replyMessageProperties = replyMessage
.getMessageProperties();
Object correlation = RabbitTemplate.this.correlationKey == null ? receiveMessageProperties
.getCorrelationId() : receiveMessageProperties
.getHeaders().get(