Search code examples
apache-pulsarmessageid

How to get unique pulsar message id in different case


interface: MessageId impl: MessageIdImpl BatchMessageIdImpl RawMessageIdImpl

The implement have different properties, different toString() method, that confused me much.


Solution

  • You should always be using message id through the interface, it supports comparison between different implementation. toString method should only be used for logging purpose. If you need to save it somewhere and restore later you need to use toByteArray and fromByteArray methods.