You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "ethanlin01x (via GitHub)" <gi...@apache.org> on 2026/08/30 14:22:12 UTC
[I] Python SDK: add store_consumer_offset and get_consumer_offset [iggy]
ethanlin01x opened a new issue, #3997:
URL: https://github.com/apache/iggy/issues/3997
### Description
The Python client cannot read or write a consumer offset directly. `poll_messages` can store an offset through `auto_commit=True`, and `IggyConsumer` has `store_offset()` / `delete_offset()`, but neither lets a caller commit an offset it chooses or ask the server what is currently stored. Every other SDK exposes the `ConsumerOffsetClient` methods on the client itself.
This blocks the common pattern of polling with `auto_commit=False` and committing only after the application has finished processing a batch. It also makes offset state impossible to inspect from Python, for example when checking consumer lag.
### Affected area / component
Python SDK
### Proposed solution
Add two methods to `IggyClient` in `foreign/python/src/client.rs`, mapping to the `ConsumerOffsetClient` trait:
```python
await client.store_consumer_offset(
stream="s", topic="t", consumer=Consumer.Single("my-app"), offset=42, partition_id=0
)
info = await client.get_consumer_offset(
stream="s", topic="t", consumer=Consumer.Single("my-app"), partition_id=0
)
if info is not None:
print(info.partition_id, info.current_offset, info.stored_offset)
```
`partition_id` stays optional, like on `poll_messages`, so a consumer group can resolve the member's assigned partition on the server.
`get_consumer_offset` needs a new `ConsumerOffsetInfo` pyclass with `partition_id`, `current_offset` and `stored_offset` getters. It returns `None` when the server has no offset for that consumer, matching `get_consumer_group`.
### Alternatives considered
_No response_
### Contribution
- [x] I'm willing to submit a pull request to implement this feature
### Good first issue
- [ ] I think this could be a good first issue for a new contributor
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org