rabbitmq / rabbitmq-java-client

RabbitMQ Java client
https://www.rabbitmq.com/java-client.html
Other
1.24k stars 572 forks source link

An interface for filtering out entities (e.g. queues) from the topology recovery cache #1312

Open michaelklishin opened 3 months ago

michaelklishin commented 3 months ago

See https://github.com/rabbitmq/rabbitmq-java-client/discussions/1311 for background.

This is a very basic proposal that would allow to mark certain entities as "unrecoverable", as in, they won't be stored in the topology recovery cache and thus won't be recovered. But also won't keep accumulating if the queues are deleted via a mechanism such as TTL, or another client.

Topology Filtering Interface

ConnectionFactory can accept a TopologyRecoveryEntityFilter (or something like that) that would accept a new methods similar in spirit to Predicate<T> but potentially with a list of parameters, e.g.

class FilterTemporaryQueues implements TopologyRecoveryEntityFilter {
  public boolean shouldRecoverQueue(String virtualHost, String name, boolean durable, boolean autoDelete, boolean exclusive, Map<String, Object> arguments);

  public boolean shouldRecoverExchange(String virtualHost, String name, String exchangeType, boolean durable, boolean autoDelete, Map<String, Object> arguments);
}

  // ...

By default, an "all-accepting" implementation can be used.