Skip to content
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

[python-client] Support KeySharedPolicy in consumer configuration #47

Open
amadav opened this issue Dec 6, 2021 · 2 comments
Open

[python-client] Support KeySharedPolicy in consumer configuration #47

amadav opened this issue Dec 6, 2021 · 2 comments

Comments

@amadav
Copy link

amadav commented Dec 6, 2021

Support for auto-hash and sticky-hash based policy (apache/pulsar#4077) was added to cpp client (apache/pulsar#7842) java (apache/pulsar#5928) & go (apache/pulsar-client-go#363) It would be great to have these changes ported to python client as well.

Describe the solution you'd like
Expose the ConsumerConfiguration::KeySharedPolicy and related setter/getter to Python client.

@github-actions
Copy link

The issue had no activity for 30 days, mark with Stale label.

@zbentley
Copy link
Contributor

This feature would be very useful for numerous use cases of ours.

@tisonkun tisonkun transferred this issue from apache/pulsar Nov 14, 2022
BewareMyPower pushed a commit that referenced this issue Jun 5, 2023
… the consumer when in KeyShared mode. (#109)

### Motivation
The pulsar python client lacks support for defining KeyShared behaviour like out of order message delivery and sticky-hash, auto-hash for consumers in KeyShared mode. This PR adds full support. The user can now provide a KeySharedPolicy when starting a consumer with client.subscribe() #47 

The ConsumerConfiguration::KeySharedPolicy and related setter/getter are now exposed to the Python client in this PR.

### Modifications

- Added pybind11 enum for KeySharedMode in src/enums.cc.
- Added pybind11 class for KeySharedPolicy in src/config.cc.
- Modified pybind11 class for ConsumerConfiguration and added function to set KeySharedPolicy and function to read KeySharedPolicy.
- Added KeySharedPolicy wrapper to pulsar/__init__.py. This wrapper handles KeySharedPolicy initialization and does some value validation.
- Added the key_shared_policy parameter to client.subscribe(), some validation, and adding to the config in pulsar/__init__.py.
- Added 4 new tests to test the new KeySharedPolicy functionality to tests/pulsar_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants