@@ -792,7 +792,7 @@ public void convertAndSend(String routingKey, Object message, MessagePostProcess
792
792
}
793
793
794
794
public void convertAndSend (String routingKey , Object message , MessagePostProcessor messagePostProcessor ,
795
- CorrelationData correlationData )
795
+ CorrelationData correlationData )
796
796
throws AmqpException {
797
797
convertAndSend (this .exchange , routingKey , message , messagePostProcessor , correlationData );
798
798
}
@@ -808,7 +808,7 @@ public void convertAndSend(String exchange, String routingKey, final Object mess
808
808
Message messageToSend = convertMessageIfNecessary (message );
809
809
messageToSend = messagePostProcessor instanceof CorrelationAwareMessagePostProcessor
810
810
? ((CorrelationAwareMessagePostProcessor ) messagePostProcessor )
811
- .postProcessMessage (messageToSend , correlationData )
811
+ .postProcessMessage (messageToSend , correlationData )
812
812
: messagePostProcessor .postProcessMessage (messageToSend );
813
813
send (exchange , routingKey , messageToSend , correlationData );
814
814
}
@@ -954,7 +954,7 @@ public <R, S> boolean receiveAndReply(ReceiveAndReplyCallback<R, S> callback, fi
954
954
955
955
@ Override
956
956
public <R , S > boolean receiveAndReply (final String queueName , ReceiveAndReplyCallback <R , S > callback , final String replyExchange ,
957
- final String replyRoutingKey ) throws AmqpException {
957
+ final String replyRoutingKey ) throws AmqpException {
958
958
return this .receiveAndReply (queueName , callback , new ReplyToAddressCallback <S >() {
959
959
960
960
@ Override
@@ -973,13 +973,13 @@ public <R, S> boolean receiveAndReply(ReceiveAndReplyCallback<R, S> callback, Re
973
973
974
974
@ Override
975
975
public <R , S > boolean receiveAndReply (String queueName , ReceiveAndReplyCallback <R , S > callback ,
976
- ReplyToAddressCallback <S > replyToAddressCallback ) throws AmqpException {
976
+ ReplyToAddressCallback <S > replyToAddressCallback ) throws AmqpException {
977
977
return doReceiveAndReply (queueName , callback , replyToAddressCallback );
978
978
}
979
979
980
980
@ SuppressWarnings ("unchecked" )
981
981
private <R , S > boolean doReceiveAndReply (final String queueName , final ReceiveAndReplyCallback <R , S > callback ,
982
- final ReplyToAddressCallback <S > replyToAddressCallback ) throws AmqpException {
982
+ final ReplyToAddressCallback <S > replyToAddressCallback ) throws AmqpException {
983
983
return this .execute (new ChannelCallback <Boolean >() {
984
984
985
985
@ SuppressWarnings ("deprecation" )
@@ -1212,7 +1212,7 @@ protected Message convertSendAndReceiveRaw(final String exchange, final String r
1212
1212
if (messagePostProcessor != null ) {
1213
1213
requestMessage = messagePostProcessor instanceof CorrelationAwareMessagePostProcessor
1214
1214
? ((CorrelationAwareMessagePostProcessor ) messagePostProcessor )
1215
- .postProcessMessage (requestMessage , correlationData )
1215
+ .postProcessMessage (requestMessage , correlationData )
1216
1216
: messagePostProcessor .postProcessMessage (requestMessage );
1217
1217
}
1218
1218
Message replyMessage = doSendAndReceive (exchange , routingKey , requestMessage , correlationData );
@@ -1279,13 +1279,18 @@ public Message doInRabbit(Channel channel) throws Exception {
1279
1279
1280
1280
@ Override
1281
1281
public void handleDelivery (String consumerTag , Envelope envelope , AMQP .BasicProperties properties ,
1282
- byte [] body ) throws IOException {
1282
+ byte [] body ) throws IOException {
1283
1283
MessageProperties messageProperties = RabbitTemplate .this .messagePropertiesConverter
1284
1284
.toMessageProperties (properties , envelope , RabbitTemplate .this .encoding );
1285
1285
Message reply = new Message (body , messageProperties );
1286
1286
if (logger .isTraceEnabled ()) {
1287
1287
logger .trace ("Message received " + reply );
1288
1288
}
1289
+ if (RabbitTemplate .this .afterReceivePostProcessors != null ) {
1290
+ for (MessagePostProcessor processor : RabbitTemplate .this .afterReceivePostProcessors ) {
1291
+ reply = processor .postProcessMessage (reply );
1292
+ }
1293
+ }
1289
1294
pendingReply .reply (reply );
1290
1295
}
1291
1296
};
@@ -1300,7 +1305,8 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp
1300
1305
try {
1301
1306
channel .basicCancel (consumerTag );
1302
1307
}
1303
- catch (Exception e ) { }
1308
+ catch (Exception e ) {
1309
+ }
1304
1310
}
1305
1311
return reply ;
1306
1312
}
@@ -1310,7 +1316,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp
1310
1316
protected Message doSendAndReceiveWithFixed (final String exchange , final String routingKey , final Message message ,
1311
1317
final CorrelationData correlationData ) {
1312
1318
Assert .state (this .isListener , "RabbitTemplate is not configured as MessageListener - "
1313
- + "cannot use a 'replyAddress': " + this .replyAddress );
1319
+ + "cannot use a 'replyAddress': " + this .replyAddress );
1314
1320
return this .execute (new ChannelCallback <Message >() {
1315
1321
1316
1322
@ SuppressWarnings ("deprecation" )
@@ -1516,7 +1522,7 @@ protected void doSend(Channel channel, String exchange, String routingKey, Messa
1516
1522
for (MessagePostProcessor processor : this .beforePublishPostProcessors ) {
1517
1523
messageToUse = processor instanceof CorrelationAwareMessagePostProcessor
1518
1524
? ((CorrelationAwareMessagePostProcessor ) processor )
1519
- .postProcessMessage (messageToUse , correlationData )
1525
+ .postProcessMessage (messageToUse , correlationData )
1520
1526
: processor .postProcessMessage (messageToUse );
1521
1527
}
1522
1528
}
@@ -1564,6 +1570,7 @@ protected boolean isChannelLocallyTransacted(Channel channel) {
1564
1570
private Message buildMessageFromDelivery (com .rabbitmq .client .QueueingConsumer .Delivery delivery ) {
1565
1571
return buildMessage (delivery .getEnvelope (), delivery .getProperties (), delivery .getBody (), -1 );
1566
1572
}
1573
+
1567
1574
private Message buildMessageFromResponse (GetResponse response ) {
1568
1575
return buildMessage (response .getEnvelope (), response .getProps (), response .getBody (), response .getMessageCount ());
1569
1576
}
@@ -1640,7 +1647,7 @@ private void addListener(Channel channel) {
1640
1647
else {
1641
1648
throw new IllegalStateException (
1642
1649
"Channel does not support confirms or returns; " +
1643
- "is the connection factory configured for confirms or returns?" );
1650
+ "is the connection factory configured for confirms or returns?" );
1644
1651
}
1645
1652
}
1646
1653
@@ -1663,7 +1670,7 @@ public void handleReturn(int replyCode,
1663
1670
String routingKey ,
1664
1671
BasicProperties properties ,
1665
1672
byte [] body )
1666
- throws IOException {
1673
+ throws IOException {
1667
1674
1668
1675
ReturnCallback returnCallback = this .returnCallback ;
1669
1676
if (returnCallback == null ) {
@@ -1766,7 +1773,7 @@ public void onMessage(Message message) {
1766
1773
else {
1767
1774
if (savedCorrelation != null ) {
1768
1775
message .getMessageProperties ().setHeader (this .correlationKey ,
1769
- savedCorrelation );
1776
+ savedCorrelation );
1770
1777
}
1771
1778
else {
1772
1779
message .getMessageProperties ().getHeaders ().remove (this .correlationKey );
0 commit comments