pulsar
pulsar copied to clipboard
[fix][client] Fix MessageIdUtils cannot handle TopicMessageId
Motivation
PIP-229 introduces an interface change for the messageId which break the behavior in and after Pulsar 3.0.
This leads to the MessageIdUtils not be able to handle the TopicMessageId. It will throw error like:
java.lang.ClassCastException: class org.apache.pulsar.client.impl.TopicMessageIdImpl cannot be cast to class org.apache.pulsar.client.impl.MessageIdImpl (org.apache.pulsar.client.impl.TopicMessageIdImpl and org.apache.pulsar.client.impl.MessageIdImpl are in unnamed module of loader 'app')
at org.apache.pulsar.client.util.MessageIdUtils.getOffset(MessageIdUtils.java:27)
...
Modifications
- Use MessageIdAdv to convert the MessageId to offset
Verifying this change
This change added tests.
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: