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
- import java .util .List ;
22
22
import java .util .function .BiPredicate ;
23
- import java .util .function .Predicate ;
24
-
25
23
import static com .rabbitmq .client .impl .recovery .TopologyRecoveryRetryHandlerBuilder .builder ;
26
24
27
25
/**
@@ -106,7 +104,7 @@ public abstract class TopologyRecoveryRetryLogic {
106
104
public static final DefaultRetryHandler .RetryOperation <Void > RECOVER_CONSUMER_QUEUE_BINDINGS = context -> {
107
105
if (context .entity () instanceof RecordedConsumer ) {
108
106
String queue = context .consumer ().getQueue ();
109
- for (RecordedBinding recordedBinding : context .connection ().getRecordedBindings ()) {
107
+ for (RecordedBinding recordedBinding : Utility . copy ( context .connection ().getRecordedBindings () )) {
110
108
if (recordedBinding instanceof RecordedQueueBinding && queue .equals (recordedBinding .getDestination ())) {
111
109
recordedBinding .recover ();
112
110
}
@@ -121,16 +119,15 @@ public abstract class TopologyRecoveryRetryLogic {
121
119
public static final DefaultRetryHandler .RetryOperation <String > RECOVER_CONSUMER = context -> context .consumer ().recover ();
122
120
123
121
/**
124
- * Pre-configured {@link DefaultRetryHandler } that retries recovery of bindings and consumers
122
+ * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder } that retries recovery of bindings and consumers
125
123
* when their respective queue is not found.
126
124
* This retry handler can be useful for long recovery processes, whereby auto-delete queues
127
125
* can be deleted between queue recovery and binding/consumer recovery.
128
126
*/
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 ()
130
128
.bindingRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
131
129
.consumerRecoveryRetryCondition (CHANNEL_CLOSED_NOT_FOUND )
132
130
.bindingRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_BINDING_QUEUE ).andThen (RECOVER_BINDING ))
133
131
.consumerRecoveryRetryOperation (RECOVER_CHANNEL .andThen (RECOVER_CONSUMER_QUEUE .andThen (RECOVER_CONSUMER )
134
- .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )))
135
- .build ();
132
+ .andThen (RECOVER_CONSUMER_QUEUE_BINDINGS )));
136
133
}
0 commit comments