1717
1818import com .rabbitmq .client .AMQP ;
1919import com .rabbitmq .client .ShutdownSignalException ;
20+ import com .rabbitmq .utility .Utility ;
2021
21- import java .util .List ;
2222import java .util .function .BiPredicate ;
23- import java .util .function .Predicate ;
24-
2523import static com .rabbitmq .client .impl .recovery .TopologyRecoveryRetryHandlerBuilder .builder ;
2624
2725/**
@@ -106,7 +104,7 @@ public abstract class TopologyRecoveryRetryLogic {
106104 public static final DefaultRetryHandler .RetryOperation <Void > RECOVER_CONSUMER_QUEUE_BINDINGS = context -> {
107105 if (context .entity () instanceof RecordedConsumer ) {
108106 String queue = context .consumer ().getQueue ();
109- for (RecordedBinding recordedBinding : context .connection ().getRecordedBindings ()) {
107+ for (RecordedBinding recordedBinding : Utility . copy ( context .connection ().getRecordedBindings () )) {
110108 if (recordedBinding instanceof RecordedQueueBinding && queue .equals (recordedBinding .getDestination ())) {
111109 recordedBinding .recover ();
112110 }
@@ -121,16 +119,15 @@ public abstract class TopologyRecoveryRetryLogic {
121119 public static final DefaultRetryHandler .RetryOperation <String > RECOVER_CONSUMER = context -> context .consumer ().recover ();
122120
123121 /**
124- * Pre-configured {@link DefaultRetryHandler } that retries recovery of bindings and consumers
122+ * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder } that retries recovery of bindings and consumers
125123 * when their respective queue is not found.
126124 * This retry handler can be useful for long recovery processes, whereby auto-delete queues
127125 * can be deleted between queue recovery and binding/consumer recovery.
128126 */
129- public static final RetryHandler RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder ()
127+ public static final TopologyRecoveryRetryHandlerBuilder RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder ()
130128 .bindingRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
131129 .consumerRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
132130 .bindingRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_BINDING_QUEUE ).andThen (RECOVER_BINDING ))
133131 .consumerRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_CONSUMER_QUEUE .andThen (RECOVER_CONSUMER )
134- .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )))
135- .build ();
132+ .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )));
136133}
0 commit comments