elephone-184 opened a new pull request, #5043:
URL: https://github.com/apache/rocketmq-dashboard/pull/5043
## What is the purpose of the change
In large enterprise clusters, thousands of topics are created over time for
temporary campaigns, deprecated microservices, or abandoned integration tests.
Many topics become **Zombies** (0 TPS, 0 messages, 0 subscriber groups) or
**Orphans** (stored messages remaining, but 0 consumer subscribers).
Accumulating hundreds of zombie topics consumes broker memory, pollutes
NameServer routing tables, and slows down metadata synchronization.
This PR introduces an automated `TopicLifecycleGovernanceEngine`:
1. `TopicLifecycleAuditReportVO`, `TopicLifecycleAssessmentVO`, &
`DecommissionCandidateVO`: Structured domain models reporting lifecycle
statistics, phase breakdown, safety risk ratings (`SAFE_TO_CLEANUP`,
`CANNOT_DELETE`, `OBSERVATION_REQUIRED`), and queue slot reclamation estimates.
2. `TopicLifecycleGovernanceEngine`: Filters out internal system topics,
cross-references live TPS, stored message count, and subscriber consumer group
count. It classifies topics into 4 discrete lifecycle phases:
- `ACTIVE`: Healthy throughput (`TPS > 0.05`), deletion strictly blocked.
- `DORMANT`: Registered subscribers but near-zero ingest.
- `ZOMBIE`: 0 throughput, 0 subscribers, 0 backlog; recommended for
immediate decommissioning to free up broker queue slots.
- `ORPHAN`: Backlog exists but 0 consumer subscribers; flagged for
archival before deletion.
3. Controller & Service wiring: Integrates through
`MetadataService.auditTopicLifecycle` and exposes `/api/topics/lifecycle-audit`
in `TopicController`.
4. Comprehensive unit test suite covering empty clusters, active topics,
dormant topics, zombie/orphan classification, and controller/service
integration.
## Brief changelog
- Add `TopicLifecycleAuditReportVO.java` domain model.
- Add `TopicLifecycleGovernanceEngine.java` lifecycle phase evaluation
engine.
- Add `auditTopicLifecycle` in `MetadataService`.
- Expose `/api/topics/lifecycle-audit` endpoint in `TopicController`.
- Add `TopicLifecycleGovernanceEngineTest.java` and expand
`MetadataServiceTest.java` and `TopicControllerTest.java`.
## Verifying this change
- `TopicLifecycleGovernanceEngineTest`: verifies system topic exclusion,
active topic safety, zombie topic detection, and orphan topic identification.
- `MetadataServiceTest`: verifies metadata service delegation to lifecycle
governance engine.
- `TopicControllerTest`: verifies `/api/topics/lifecycle-audit` REST
endpoint response mapping.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]