17
17
18
18
import com .rabbitmq .client .AMQP ;
19
19
import com .rabbitmq .client .ShutdownSignalException ;
20
+ import com .rabbitmq .utility .Utility ;
20
21
21
22
import static com .rabbitmq .client .impl .recovery .TopologyRecoveryRetryHandlerBuilder .builder ;
22
23
@@ -136,7 +137,7 @@ public String call(RetryContext context) throws Exception {
136
137
public Void call (RetryContext context ) throws Exception {
137
138
if (context .entity () instanceof RecordedConsumer ) {
138
139
String queue = context .consumer ().getQueue ();
139
- for (RecordedBinding recordedBinding : context .connection ().getRecordedBindings ()) {
140
+ for (RecordedBinding recordedBinding : Utility . copy ( context .connection ().getRecordedBindings () )) {
140
141
if (recordedBinding instanceof RecordedQueueBinding && queue .equals (recordedBinding .getDestination ())) {
141
142
recordedBinding .recover ();
142
143
}
@@ -147,16 +148,15 @@ public Void call(RetryContext context) throws Exception {
147
148
};
148
149
149
150
/**
150
- * Pre-configured {@link DefaultRetryHandler } that retries recovery of bindings and consumers
151
+ * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder } that retries recovery of bindings and consumers
151
152
* when their respective queue is not found.
152
153
* This retry handler can be useful for long recovery processes, whereby auto-delete queues
153
154
* can be deleted between queue recovery and binding/consumer recovery.
154
155
*/
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 ()
156
157
.bindingRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
157
158
.consumerRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
158
159
.bindingRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_BINDING_QUEUE ).andThen (RECOVER_BINDING ))
159
160
.consumerRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_CONSUMER_QUEUE .andThen (RECOVER_CONSUMER )
160
- .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )))
161
- .build ();
161
+ .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )));
162
162
}
0 commit comments