1717
1818import com .rabbitmq .client .AMQP ;
1919import com .rabbitmq .client .ShutdownSignalException ;
20+ import com .rabbitmq .utility .Utility ;
2021
2122import static com .rabbitmq .client .impl .recovery .TopologyRecoveryRetryHandlerBuilder .builder ;
2223
@@ -136,7 +137,7 @@ public String call(RetryContext context) throws Exception {
136137 public Void call (RetryContext context ) throws Exception {
137138 if (context .entity () instanceof RecordedConsumer ) {
138139 String queue = context .consumer ().getQueue ();
139- for (RecordedBinding recordedBinding : context .connection ().getRecordedBindings ()) {
140+ for (RecordedBinding recordedBinding : Utility . copy ( context .connection ().getRecordedBindings () )) {
140141 if (recordedBinding instanceof RecordedQueueBinding && queue .equals (recordedBinding .getDestination ())) {
141142 recordedBinding .recover ();
142143 }
@@ -147,16 +148,15 @@ public Void call(RetryContext context) throws Exception {
147148 };
148149
149150 /**
150- * Pre-configured {@link DefaultRetryHandler } that retries recovery of bindings and consumers
151+ * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder } that retries recovery of bindings and consumers
151152 * when their respective queue is not found.
152153 * This retry handler can be useful for long recovery processes, whereby auto-delete queues
153154 * can be deleted between queue recovery and binding/consumer recovery.
154155 */
155- public static final RetryHandler RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder ()
156+ public static final TopologyRecoveryRetryHandlerBuilder RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder ()
156157 .bindingRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
157158 .consumerRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
158159 .bindingRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_BINDING_QUEUE ).andThen (RECOVER_BINDING ))
159160 .consumerRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_CONSUMER_QUEUE .andThen (RECOVER_CONSUMER )
160- .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )))
161- .build ();
161+ .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )));
162162}
0 commit comments