lhotari commented on code in PR #25573: URL: https://github.com/apache/pulsar/pull/25573#discussion_r3140536366
########## 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: It would be useful to clarify this since it leaves a lot of questions about how this could work. Does a StreamConsumer allow any parallelism? Is this message id a client side state or does the message id get assigned already on the broker? Is the state mutable or immutable? Most likely this id isn't stable. Just wondering if the concept of a message id is correct if the id changes. It seems more like an acknowledgement token. Is that right? We already hold additional mutable state in the BatchMessageIdImpl.ackSet field. Is this approach something similar where the state is piggy backed on the message id on the client side? UPDATE: I found the answer in ScalableStreamConsumer (it's client side state). I'll leave these questions just in case it helps to clarify the javadoc here for future readers. :) -- 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]
