merlimat commented on code in PR #25573: URL: https://github.com/apache/pulsar/pull/25573#discussion_r3140838492
########## pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/MessageIdV5.java: ########## @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.client.impl.v5; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.Objects; +import org.apache.pulsar.client.api.v5.MessageId; + +/** + * V5 MessageId implementation that wraps a v4 MessageId and includes a position + * vector across all segments. + * + * <p>The position vector captures the latest delivered message ID per segment at the + * moment this message was dequeued. This enables correct cumulative acknowledgment: + * when the application acknowledges this message, all segments are advanced to the + * positions recorded in the vector, not just the segment this message came from. + * Review Comment: The state it's only on the client side, used for cumulative acks. Since you have a single `StreamingConsumer` object, potentially reading from multiple segments, when you do a cumulativeAck on `m1` we need to ack all the messages that the application has seen, from all segments, so this map is just reflecting the last message received from each segment before this particular message. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
