apache / apache/pulsar-client-cpp

[Bug] Subscription Properties aren't enforced for Consumer

Aperta
#495 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
71
Fork
90
Merge medio
2h 33m
PR unite (30g)
3

Descrizione

### 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!

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
distributed-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.