Pulsar Admin: expose the compression algoritm for "peek messages"
eolivelli opened this issue · comments
Enrico Olivelli commented
Search before asking
- I searched in the issues and found nothing similar.
Motivation
When troubleshooting production enviroments it would be helpful to see with "peek message" the algorithm used for compression
Solution
Dump the value when prossing the peek messages command
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
道君 commented
It looks PersistentTopics already exposed CompressType of the message, but Message
API didn't expose the method of getting compressType.
Maybe we need a PIP for the issue, or cast Message<byte[]> to MessageImpl
:
List<Message<byte[]>> messages = admin.topics.peekMessages("topic", "sub", 10);
for (Message<byte[]> msg : messages) {
MessageImpl<byte[]> impl = (MessageImpl<byte[]>) msg;
MessageMetadata metadata = impl.getMessageBuilder();
System.out.println(metadata.getCompressType());
}