Skip to content

Failed to execute Consumer#getLastMessageId when setting brokerEntryMetadataInterceptors #10950

Closed

Description

@wuzhanpeng

Describe the bug
After setting brokerEntryMetadataInterceptors parameters in conf/broker.conf, we found that we cannot invoke method org.apache.pulsar.client.api.Consumer#getLastMessageId normally. At the same time, the log also prompted that an exception occurred during metadata parsing.

To Reproduce
Steps to reproduce the behavior:

  1. set parameters in conf/broker.conf as we used in KoP
# refer to https://github.com/streamnative/kop/blob/master/docs/kop.md
brokerEntryMetadataInterceptors=org.apache.pulsar.common.intercept.AppendIndexMetadataInterceptor,org.apache.pulsar.common.intercept.AppendBrokerTimestampMetadataInterceptor
  1. execute a program like:
admin.topics().createNonPartitionedTopic(topic);
Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
        .topic(topic)
        .create();
producer.newMessage().key("k1").value("mm").send();

Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING)
        .topic(topic)
        .subscriptionName(group)
        .subscribe();
consumer.getLastMessageId();

Expected behavior
Able to correctly execute Consumer#getLastMessageId in this scenario.

Screenshots

org.apache.pulsar.client.api.PulsarClientException$BrokerMetadataException: 
The subscription XXX of the topic YYY gets the last message id was failed
Failed to get batch size for entry java.lang.IllegalArgumentException: Invalid unknonwn tag type: 6
        at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:987)
        at org.apache.pulsar.client.impl.ConsumerBase.getLastMessageId(ConsumerBase.java:606)

Additional context
I can help submit a PR later.

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

Metadata

Metadata

Assignees

Labels

type/bugThe PR fixed a bug or issue reported a bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions