-
Notifications
You must be signed in to change notification settings - Fork 89
Scalable Topics: pulsar::st queue consumer — per-segment fan-in over a mux receive queue
#605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
merlimat
merged 14 commits into
apache:main
from
merlimat:scalable-topics-queue-consumer
Aug 29, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
779e2cf
st: received-message plumbing — MessageImpl + MessageCore accessors
merlimat b0c7d11
st: classic consumer segment seam — subscribeSegmentAsync
merlimat f4f9ff5
st: clang-format-11 line wrapping in segment seam + MessageImpl ctor
merlimat e110361
st: queue consumer core — per-segment fan-in over a mux receive queue
merlimat 6b3285e
Handle CommandReachedEndOfTopic on the consumer receive path
merlimat 7475790
st: queue consumer produce->consume e2e test
merlimat acaddbf
st: drive queue-consumer e2e split through the admin REST API
merlimat 1dceca4
Merge remote-tracking branch 'apache/main' into scalable-topics-queue…
merlimat eec4aac
st: address #605 review — clang-tidy move + drained-segment re-subscribe
merlimat cce4b82
Terminated-topic completeness on the consumer: reconnect + sync receive
merlimat 23136c4
st: queue consumer drain, robustness, and honesty fixes from #605 review
merlimat 60c763b
st: e2e for draining a sealed segment's backlog with sticking acks
merlimat 1cbbaa5
Pin jidicula/clang-format-action to its commit SHA for the ASF action…
merlimat 740b050
Merge remote-tracking branch 'apache/main' into scalable-topics-queue…
merlimat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * 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. | ||
| */ | ||
| #include <pulsar/st/detail/MessageCore.h> | ||
|
|
||
| #include "MessageImpl.h" | ||
|
|
||
| namespace pulsar::st::detail { | ||
|
|
||
| // Thin forwarders to the hidden MessageImpl (see ProducerCore.cc for the same pattern). | ||
| std::span<const std::byte> MessageCore::data() const { return impl_->data(); } | ||
| MessageId MessageCore::id() const { return impl_->id(); } | ||
| std::optional<std::string_view> MessageCore::key() const { return impl_->key(); } | ||
| const Properties& MessageCore::properties() const { return impl_->properties(); } | ||
| Timestamp MessageCore::publishTime() const { return impl_->publishTime(); } | ||
| std::optional<Timestamp> MessageCore::eventTime() const { return impl_->eventTime(); } | ||
| int64_t MessageCore::sequenceId() const { return impl_->sequenceId(); } | ||
| std::optional<std::string_view> MessageCore::producerName() const { return impl_->producerName(); } | ||
| std::string_view MessageCore::topic() const { return impl_->topic(); } | ||
| int MessageCore::redeliveryCount() const { return impl_->redeliveryCount(); } | ||
| std::optional<std::string_view> MessageCore::replicatedFrom() const { return impl_->replicatedFrom(); } | ||
|
|
||
| } // namespace pulsar::st::detail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| /** | ||
| * 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. | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <pulsar/Message.h> | ||
| #include <pulsar/st/MessageId.h> | ||
| #include <pulsar/st/detail/MessageCore.h> | ||
|
|
||
| #include <chrono> | ||
| #include <cstddef> | ||
| #include <cstdint> | ||
| #include <optional> | ||
| #include <span> | ||
| #include <string> | ||
| #include <string_view> | ||
| #include <utility> | ||
|
|
||
| namespace pulsar::st { | ||
|
|
||
| /** | ||
| * INTERNAL — the received message behind `detail::MessageCore`. | ||
| * | ||
| * A thin view over a classic `pulsar::Message` (which owns the payload and metadata) | ||
| * plus the segment-qualified `pulsar::st::MessageId` minted on the receive path. An | ||
| * optional `topicOverride` carries the scalable topic identity in namespace mode | ||
| * (a plain segment consumer reports the segment backing topic otherwise). | ||
| */ | ||
| class MessageImpl { | ||
| public: | ||
| MessageImpl(pulsar::Message message, MessageId id, | ||
| std::optional<std::string> topicOverride = std::nullopt) | ||
| : classic_(std::move(message)), id_(std::move(id)), topicOverride_(std::move(topicOverride)) {} | ||
|
|
||
| std::span<const std::byte> data() const { | ||
| return {static_cast<const std::byte*>(classic_.getData()), classic_.getLength()}; | ||
| } | ||
| const MessageId& id() const { return id_; } | ||
| std::optional<std::string_view> key() const { | ||
| if (!classic_.hasPartitionKey()) return std::nullopt; | ||
| return std::string_view(classic_.getPartitionKey()); | ||
| } | ||
| const Properties& properties() const { return classic_.getProperties(); } | ||
| Timestamp publishTime() const { return fromMillis(classic_.getPublishTimestamp()); } | ||
| std::optional<Timestamp> eventTime() const { | ||
| const uint64_t millis = classic_.getEventTimestamp(); | ||
| return millis != 0 ? std::optional<Timestamp>(fromMillis(millis)) : std::nullopt; | ||
| } | ||
| // The classic public Message API does not expose the message's sequence id; populating it | ||
| // would require reaching into pulsar::MessageImpl's metadata, i.e. touching the classic API. | ||
| // TODO: revisit when the Stream consumer needs it (a classic Message::getSequenceId() accessor). | ||
| int64_t sequenceId() const { return -1; } | ||
| std::optional<std::string_view> producerName() const { | ||
| const std::string& name = classic_.getProducerName(); | ||
| return name.empty() ? std::nullopt : std::optional<std::string_view>(name); | ||
| } | ||
| std::string_view topic() const { | ||
| return topicOverride_ ? std::string_view(*topicOverride_) : std::string_view(classic_.getTopicName()); | ||
| } | ||
| int redeliveryCount() const { return classic_.getRedeliveryCount(); } | ||
| std::optional<std::string_view> replicatedFrom() const { | ||
| const std::optional<const std::string*> from = classic_.getReplicatedFrom(); | ||
| if (!from || *from == nullptr) return std::nullopt; | ||
| return std::string_view(**from); | ||
| } | ||
|
|
||
| private: | ||
| static Timestamp fromMillis(uint64_t millis) { | ||
| return Timestamp(std::chrono::milliseconds(static_cast<std::int64_t>(millis))); | ||
| } | ||
|
|
||
| pulsar::Message classic_; | ||
| MessageId id_; | ||
| std::optional<std::string> topicOverride_; | ||
| }; | ||
|
|
||
| } // namespace pulsar::st |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.