You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ydb/docs/en/core/reference/ydb-sdk/topic.md
+26
Original file line number
Diff line number
Diff line change
@@ -1928,6 +1928,32 @@ Reading progress is usually saved on a server for each Consumer. However, such p
1928
1928
}
1929
1929
```
1930
1930
1931
+
- Python
1932
+
1933
+
To read without a `Consumer`, create a reader using the `reader` method with specifying these arguments:
1934
+
*`topic`-`ydb.TopicReaderSelector`objectwith defined `path`and`partitions`list;
1935
+
*`consumer`- should be `None`;
1936
+
*`event_handler`-`ydb.TopicReaderEvents.EventHandler` inheritor with defined `on_partition_get_start_offset` method. This method will calculate the starting offset when the reader starts, as well as when it reconnects. It can be asynchronous.
1937
+
1938
+
Full example:
1939
+
1940
+
```python
1941
+
class CustomEventHandler(ydb.TopicReaderEvents.EventHandler):
Copy file name to clipboardExpand all lines: ydb/docs/ru/core/reference/ydb-sdk/topic.md
+26
Original file line number
Diff line number
Diff line change
@@ -1931,6 +1931,32 @@
1931
1931
}
1932
1932
```
1933
1933
1934
+
- Python
1935
+
1936
+
Для чтения без `Consumer`а следует создать читателя с помощью метода `reader` с указанием следующих аргументов:
1937
+
* `topic` - объект `ydb.TopicReaderSelector` с указанными `path` и списком `partitions`;
1938
+
* `consumer` - должен быть `None`;
1939
+
* `event_handler` - наследник `ydb.TopicReaderEvents.EventHandler` с определенной функцией `on_partition_get_start_offset`. Благодаря этой функции будет высчитываться стартовый offset при старте читателя, а так же при его переподключениях. Может быть асинхронной.
1940
+
1941
+
Полный пример:
1942
+
1943
+
```python
1944
+
class CustomEventHandler(ydb.TopicReaderEvents.EventHandler):
0 commit comments