提交 153d190a 编写于 作者: B Brian Candler 提交者: xiaolong.ran

Add is_read_compacted to create_reader() in python API (#5483)

Fixes #5365

(cherry picked from commit 49a8658c)
上级 6162a71f
......@@ -552,6 +552,8 @@ class Client:
* `broker_consumer_stats_cache_time_ms`:
Sets the time duration for which the broker-side consumer stats will
be cached in the client.
* `is_read_compacted`:
Selects whether to read the compacted version of the topic
* `properties`:
Sets the properties for the consumer. The properties associated with a consumer
can be used for identify a consumer at broker side.
......@@ -621,7 +623,8 @@ class Client:
reader_listener=None,
receiver_queue_size=1000,
reader_name=None,
subscription_role_prefix=None
subscription_role_prefix=None,
is_read_compacted=False
):
"""
Create a reader on a particular topic
......@@ -669,6 +672,8 @@ class Client:
Sets the reader name.
* `subscription_role_prefix`:
Sets the subscription role prefix.
* `is_read_compacted`:
Selects whether to read the compacted version of the topic
"""
_check_type(str, topic, 'topic')
_check_type(_pulsar.MessageId, start_message_id, 'start_message_id')
......@@ -676,6 +681,7 @@ class Client:
_check_type(int, receiver_queue_size, 'receiver_queue_size')
_check_type_or_none(str, reader_name, 'reader_name')
_check_type_or_none(str, subscription_role_prefix, 'subscription_role_prefix')
_check_type(bool, is_read_compacted, 'is_read_compacted')
conf = _pulsar.ReaderConfiguration()
if reader_listener:
......@@ -686,6 +692,7 @@ class Client:
if subscription_role_prefix:
conf.subscription_role_prefix(subscription_role_prefix)
conf.schema(schema.schema_info())
conf.read_compacted(is_read_compacted)
c = Reader()
c._reader = self._client.create_reader(topic, start_message_id, conf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册