0

interface: MessageId impl: MessageIdImpl BatchMessageIdImpl RawMessageIdImpl

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

h.xn
  • 25
  • 1
  • 5

1 Answers1

1

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.

Lanayx
  • 2,731
  • 1
  • 23
  • 35
  • Pulsar work as message queue service in our group, the monitor service, tracing service or more service need to identify the message by id with pulsar. It is nature to share id as number or String, `toByteArray` method is strange to me. – h.xn Apr 15 '21 at 02:41
  • The reason for it is that MessageId is a complex structure, not just a simple number or string. You can convert byte array to base64 in you code if needed. – Lanayx Apr 15 '21 at 10:27