diff options
author | rekby <rekby@ydb.tech> | 2023-06-07 13:03:56 +0300 |
---|---|---|
committer | rekby <rekby@ydb.tech> | 2023-06-07 13:03:56 +0300 |
commit | ef854dbcf2e5f1dd1d75c96b2ea4fba819f7ae3f (patch) | |
tree | 9c6e994f0e1148d9b2f6c8a825c9e9b164c6ad6a | |
parent | 1e15d27332622ed8ad02eb5ff93058621e67cbb0 (diff) | |
download | ydb-ef854dbcf2e5f1dd1d75c96b2ea4fba819f7ae3f.tar.gz |
read from topic with commit
-rw-r--r-- | ydb/docs/en/core/reference/ydb-sdk/topic.md | 7 | ||||
-rw-r--r-- | ydb/docs/ru/core/reference/ydb-sdk/topic.md | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ydb/docs/en/core/reference/ydb-sdk/topic.md b/ydb/docs/en/core/reference/ydb-sdk/topic.md index 7f5e678ff7a..ee89ade7762 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -1,3 +1,4 @@ +<!-- This file is not tracked by the automatic translation system. Edits to the RU-version must be made yourself. --> # Working with topics This article provides examples of how to use the {{ ydb-short-name }} SDK to work with [topics](../../concepts/topic.md). @@ -398,7 +399,11 @@ To read message batches, use the following code: {% endlist %} -#### Reading with a commit {#commit} +### Reading with a commit {#commit} + +Confirmation of message processing (commit) informs the server that the message from the topic has been processed by the recipient and does not need to be sent anymore. When using acknowledged reading, it is necessary to confirm all received messages without skipping any. Message commits on the server occur after confirming a consecutive interval of messages "without gaps," and the confirmations themselves can be sent in any order. + +For example, if messages 1, 2, 3 are received from the server, the program processes them in parallel and sends confirmations in the following order: 1, 3, 2. In this case, message 1 will be committed first, and messages 2 and 3 will be committed only after the server receives confirmation of the processing of message 2. To commit messages one by one, use the following code: diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index cd81d312591..26bb576483f 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -1,3 +1,4 @@ +<!-- Этот файл не отслеживается автоматической системой перевода. Правки в EN-версию необходимо внести самостоятельно. --> # Работа с топиками В этой статье приведены примеры использования {{ ydb-short-name }} SDK для работы с [топиками](../../concepts/topic.md). @@ -398,7 +399,11 @@ SDK получает данные с сервера партиями и буфе {% endlist %} -#### Чтение с подтверждением обработки сообщений {#commit} +### Чтение с подтверждением обработки сообщений {#commit} + +Подтверждение обработки сообщения (коммит) - сообщает серверу, что сообщение из топика обработано получателем и больше его отправлять не нужно. При использовании чтения с подтверждением нужно подтверждать все полученные сообщения без пропуска. Коммит сообщений на сервере происходит после подтверждения очередного интервала сообщений «без дырок», сами подтверждения при этом можно отправлять в любом порядке. + +Например с сервера пришли сообщения 1, 2, 3. Программа обрабатывает их параллельно и отправляет подтверждения в таком порядке: 1, 3, 2. В этом случае сначала будет закоммичено сообщение 1, а сообщения 2 и 3 будут закоммичены только после того как сервер получит подтверждение об обработке сообщения 2. Чтобы подтверждать обработку сообщений по одному, используйте следующий код: |