Skip to content

Conversation

@sushantmane
Copy link
Contributor

[admin-tool] Refactor DumpAdminMessages to log messages as they are received

  • Changed dumpAdminMessages() to log messages immediately instead of buffering
  • Added Logger similar to KafkaTopicDumper pattern
  • Removed unused AdminOperationInfo inner class
  • Moved getPubSubConsumerProperties to AdminTool, then replaced with PubSubUtil.addPubSubBrokerAddress
  • Updated AdminTool.dumpAdminMessages() to use try-with-resources

Code changes

  • Added new code behind a config. If so list the config names and their default values in the PR description.
  • Introduced new log lines.
    • Confirmed if logs need to be rate limited to avoid excessive logging.

Concurrency-Specific Checks

Both reviewer and PR author to verify

  • Code has no race conditions or thread safety issues.
  • Proper synchronization mechanisms (e.g., synchronized, RWLock) are used where needed.
  • No blocking calls inside critical sections that could lead to deadlocks or performance degradation.
  • Verified thread-safe collections are used (e.g., ConcurrentHashMap, CopyOnWriteArrayList).
  • Validated proper exception handling in multi-threaded code to avoid silent thread termination.

How was this PR tested?

  • New unit tests added.
  • New integration tests added.
  • Modified or extended existing tests.
  • Verified backward compatibility (if applicable).

Does this PR introduce any user-facing or breaking changes?

  • No. You can skip the rest of this section.
  • Yes. Clearly explain the behavior change and its impact.

- Changed dumpAdminMessages() to log messages immediately instead of buffering
- Added Logger similar to KafkaTopicDumper pattern
- Changed return type from List<AdminOperationInfo> to int (count)
- Removed unused AdminOperationInfo inner class
- Moved getPubSubConsumerProperties to AdminTool, then replaced with PubSubUtil.addPubSubBrokerAddress
- Updated AdminTool.dumpAdminMessages() to use try-with-resources
- Updated tests to work with new return type
Copilot AI review requested due to automatic review settings January 24, 2026 21:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the DumpAdminMessages utility to log admin messages as they are received instead of buffering them in memory. The changes improve resource management and follow existing patterns in the codebase.

Changes:

  • Replaced buffering with immediate logging of admin messages using Log4j logger
  • Added try-with-resources for proper consumer cleanup
  • Consolidated SSL validation logic by replacing getPubSubConsumerProperties with existing utilities

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
DumpAdminMessages.java Removed AdminOperationInfo inner class, changed return type to int, added logger for immediate message output, removed redundant getPubSubConsumerProperties method
AdminTool.java Added try-with-resources for consumer management, replaced custom method with PubSubUtil.addPubSubBrokerAddress
TestAdminToolConsumption.java Updated test to verify integer count instead of list size

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Update ProducerMd logging to use expanded format matching KafkaTopicDumper:
ProducerMd:(guid:{},seg:{},seq:{},mts:{},lts:{}) instead of toString()
Copilot AI review requested due to automatic review settings January 25, 2026 00:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant