@@ -425,22 +425,7 @@ protected void actualStart() {
425425 super .doStart ();
426426 final String [] queueNames = getQueueNames ();
427427 checkMissingQueues (queueNames );
428- if (isPossibleAuthenticationFailureFatal ()) {
429- Connection connection = null ;
430- try {
431- getConnectionFactory ().createConnection ();
432- }
433- catch (AmqpAuthenticationException ex ) {
434- throw ex ;
435- }
436- catch (Exception ex ) { // NOSONAR
437- }
438- finally {
439- if (connection != null ) {
440- connection .close ();
441- }
442- }
443- }
428+ checkConnect ();
444429 long idleEventInterval = getIdleEventInterval ();
445430 if (this .taskScheduler == null ) {
446431 afterPropertiesSet ();
@@ -469,6 +454,26 @@ protected void actualStart() {
469454 }
470455 }
471456
457+ protected void checkConnect () {
458+ if (isPossibleAuthenticationFailureFatal ()) {
459+ Connection connection = null ;
460+ try {
461+ getConnectionFactory ().createConnection ();
462+ }
463+ catch (AmqpAuthenticationException ex ) {
464+ this .logger .debug ("Failed to authenticate" , ex );
465+ throw ex ;
466+ }
467+ catch (Exception ex ) { // NOSONAR
468+ }
469+ finally {
470+ if (connection != null ) {
471+ connection .close ();
472+ }
473+ }
474+ }
475+ }
476+
472477 private void startMonitor (long idleEventInterval , final Map <String , Queue > namesToQueues ) {
473478 this .consumerMonitorTask = this .taskScheduler .scheduleAtFixedRate (() -> {
474479 long now = System .currentTimeMillis ();
0 commit comments