@@ -954,27 +954,33 @@ protected boolean useDirectReplyTo() {
954
954
});
955
955
}
956
956
catch (AmqpConnectException | AmqpIOException ex ) {
957
- Throwable cause = ex ;
958
- while (cause != null && !(cause instanceof ShutdownSignalException )) {
959
- cause = cause .getCause ();
957
+ if (shouldRethrow (ex )) {
958
+ throw ex ;
960
959
}
961
- if (cause != null && RabbitUtils .isPassiveDeclarationChannelClose ((ShutdownSignalException ) cause )) {
962
- if (logger .isWarnEnabled ()) {
963
- logger .warn ("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary "
964
- + "queues will be used: " + cause .getMessage () + "." );
965
- }
966
- this .replyAddress = null ;
967
- return false ;
968
- }
969
- if (logger .isDebugEnabled ()) {
970
- logger .debug ("IO error, deferring directReplyTo detection: " + ex .toString ());
971
- }
972
- throw ex ;
973
960
}
974
961
}
975
962
return false ;
976
963
}
977
964
965
+ private boolean shouldRethrow (AmqpException ex ) {
966
+ Throwable cause = ex ;
967
+ while (cause != null && !(cause instanceof ShutdownSignalException )) {
968
+ cause = cause .getCause ();
969
+ }
970
+ if (cause != null && RabbitUtils .isPassiveDeclarationChannelClose ((ShutdownSignalException ) cause )) {
971
+ if (logger .isWarnEnabled ()) {
972
+ logger .warn ("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary "
973
+ + "queues will be used: " + cause .getMessage () + "." );
974
+ }
975
+ this .replyAddress = null ;
976
+ return false ;
977
+ }
978
+ if (logger .isDebugEnabled ()) {
979
+ logger .debug ("IO error, deferring directReplyTo detection: " + ex .toString ());
980
+ }
981
+ return true ;
982
+ }
983
+
978
984
@ Override
979
985
public void send (Message message ) throws AmqpException {
980
986
send (this .exchange , this .routingKey , message );
0 commit comments