WaterWhisperer commented on code in PR #3581:
URL: https://github.com/apache/iggy/pull/3581#discussion_r3511032834
##########
foreign/python/src/client.rs:
##########
@@ -243,6 +246,107 @@ impl IggyClient {
})
}
+ /// Create a consumer group for a stream topic.
+ ///
+ /// Args:
+ /// stream_id: Stream identifier as `str | int`.
+ /// topic_id: Topic identifier as `str | int`.
+ /// name: Consumer group name as `str`.
+ ///
+ /// Returns:
+ /// An awaitable that resolves to `None` when the consumer group is
created.
+ ///
+ /// Raises:
+ /// PyRuntimeError: If an identifier is invalid or the request fails.
+
#[gen_stub(override_return_type(type_repr="collections.abc.Awaitable[None]",
imports=("collections.abc")))]
+ fn create_consumer_group<'a>(
+ &self,
+ py: Python<'a>,
+ stream_id: PyIdentifier,
+ topic_id: PyIdentifier,
+ name: String,
+ ) -> PyResult<Bound<'a, PyAny>> {
+ let stream_id = Identifier::try_from(stream_id)?;
+ let topic_id = Identifier::try_from(topic_id)?;
+ let inner = self.inner.clone();
+
+ future_into_py(py, async move {
+ inner
+ .create_consumer_group(&stream_id, &topic_id, &name)
+ .await
+ .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError,
_>(e.to_string()))?;
+ Ok(())
Review Comment:
> this matches how the `create_stream`/`create_topic` bindings already
behave so it's not a regression
yeah, it's just to keep it consistent here
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]