Automatic topic removal
You can use an automatic topic removal policy to remove topics when a set of conditions you specify is met.
A simple use case would be a policy that automatically removes a topic if it has not been updated for a day.
A policy can remove the topic it applies to,
or a set of topics specified with a path selector. For example, a policy could
say that if topic a has not been updated for a day, topics b/1 and
b/2 get removed.
An automatic topic removal policy is set with the REMOVAL topic property.
The property is specified with an expression including the conditions and the optional selector specifying topics to remove.
See Removing topics automatically for details.
Consider the following factors when using automatic topic removal:
- If persistence is not enabled for a topic, the topic will be removed when a server shuts
down, regardless of the removal policy.
- If persistence is enabled for a topic, the topic's removal policy will persist.
After a server is shut down and restarted, the removal policy will continue to
- Policies are evaluated every few seconds, so a time-based removal policy
may not be applied at the exact second specified.
- Automatic topic removal is supported for replicated topics. The removal policy conditions
will be evaluated across the whole cluster.
- If your application requires a private topic for each user/principal,
you can use Topic ownership with an automatic topic removal
policy to remove the topic when the user stops being active.