feat(example): basic example for python sdk#2118
Conversation
|
I'm wondering if for most use cases we should encourage the use of consumer groups? My gut feeling is that the consumer group API is the right fit for most use cases. It would not be aligned with the Rust examples though so maybe that is a broader discussion of what abstraction level is right to introduce most users to? What do you think? |
|
I'm okay with that. The rust basic example actually allows users to run either a regular consumer or a consumer group. Because of all the shared functions in the rust examples, it's kind of difficult to completely align with those examples, and thus I think it's okay if we want to add options to the python examples (this basic example specifically) to allow users to chose which kind of consumer to use. For now demonstrating how to create a consumer group with the SDK should be sufficient. What would help more in my opinion is to explain these two types of consumers clearly in the documentation. I'll add the consumer group as an option and we see how it goes? |
hubcio
left a comment
There was a problem hiding this comment.
in general i'm fine with this approach but there is one missing thing: could you prepare a script, similar to scripts/run-go-examples-from-readme.sh or scripts/run-rust-examples-from-readme.sh where you'll explicitly test those examples?
|
Yes. My plan is to reuse foreign/python/scripts/test.sh and I do have a local implementation. I'll set up the test properly after #2101 is merged to avoid conflicts. |
|
I've decided to keep the current polling consumer for now. I tried out the consumer group and I don't think the python API is actually ready to be used. Apart from some obvious issues, usability is horrible and we definitely need to redesign this. |
Created a basic example for the python SDK that sort of matches`examples/rust/basic`. It demonstrates how to configure clients using connection strings. Overall it's pretty similar to the `getting-started` example. This example is a bit different from `examples/rust/basic` because the Rust client builder struct and config types are not exposed through the python SDK as explained in apache#2110.

Description
Created a basic example for the python SDK that sort of matches
examples/rust/basic. It demonstrates how to configure clients using connection strings. Overall it's pretty similar to thegetting-startedexample.This example is a bit different from
examples/rust/basicbecause the rust client builder struct and config types are not exposed through the python SDK as explained in #2110.Testing
ruff check --select I .