Skip to content

[Pulsar Websocket] Consumer message can't be acknowleaged successfully after toByteArray & fromByteArray #12059

@yakir-Yang

Description

@yakir-Yang

Case 1. After receiving the message from Pulsar consumer, just calling the consumer.acknowledge() immediately, this message can be acknowledged successfully. Here's the code

consumer.receiveAsync().thenAccept(msg -> {
    consumer.acknowledge(msg.getMessageId());
    ....
}

Case 2. If I calling the toByteArray & fromByteArrayWithTopic functions, the message just can't be acknowledged successfully.

consumer.receiveAsync().thenAccept(msg -> {
    MessageId msgId = MessageId.fromByteArrayWithTopic(msg.getMessageId().toByteArray(), topic.toString());
    consumer.acknowledgeAsync(msgId);
    ....
}

Case 3. If I calling the toByteArray & fromByteArray functions, the message just still can't be acknowledged successfully.

consumer.receiveAsync().thenAccept(msg -> {
    MessageId msgId = MessageId.fromByteArray(msg.getMessageId().toByteArray());
   consumer.acknowledgeAsync(msgId);
    ....
}

Case 4. Still failed

consumer.receiveAsync().thenAccept(msg -> {
    String messageId = Base64.getEncoder().encodeToString(msg.getMessageId().toByteArray());
    MessageId msgId = MessageId.fromByteArrayWithTopic(Base64.getDecoder().decode(messageId), topic.toString());
    consumer.acknowledgeAsync(msgId);
    ....
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions