apache / apache/pulsar-client-cpp

[Bug] Subscription Properties aren't enforced for Consumer

オープン
#495 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
71
フォーク
90
平均マージ
2時間 33分
マージ済み PR(30日)
3

説明

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing similar.

### Version

Using Pulsar v3.0.7 and pulsar-client-cpp 3.7.1

### Minimal reproduce step

Connect two shared consumers to the same topic under the same subscription name, but specify different subscription properties in the ConsumerConfiguration.

### What did you expect to see?

When the subscription is created, it was have persistent properties set matching one of the consumers' configurations. According to the doc comment on the subscription properties configuration here: https://github.com/apache/pulsar-client-cpp/blob/main/include/pulsar/ConsumerConfiguration.h#L518, if the properties specified don't match those on the broker, the consumer should fail to connect. The comment doesn't say what error code will be returned... and I don't see anything that really corresponds to this condition in the `pulsar::Result` enum.

### What did you see instead?

The consumer connects just fine with the wrong properties and will receive messages. There is no error returned from the `subscribe` method. The properties don't change, which is expected.

### Anything else?

Is this a bug, or is the comment incorrect? The comment on the [Java API] is similar, but I'm wondering if they're both wrong, since presumably this would be enforced on the broker? The lack of a `pulsar::Result` code for this condition makes me think this behavior was never implemented. The comment is somewhat incoherent in any case: it claims `consumers under the same subscription will fail to create a subscription if they use different properties`, but consumers under the same subscription won't be *creating* a subscription more than once either way: the first one to connect creates the subscription, and the others connect to that subscription. Furthermore, I wouldn't necessarily call the properties "immutable", since there's an admin API endpoint to change them.

I'm happy to file a bug under the main Pulsar project if this behavior *is* expected, but I suspect these comments are just incorrect. I just want to confirm what the expected behavior is going forward before I make a wrong design choice in my application. Thank you!

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start at include/pulsar/ConsumerConfiguration.h around line 518, then trace the subscribe path and pulsar::Result enum; compare the documented C++ behavior with the Java API and broker-side subscription-property handling. Done means the expected behavior is confirmed and the documentation or error handling is aligned, with a regression test if this path has repository coverage.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
distributed-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
32/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。