Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add notification about close reader #13368

Merged
merged 12 commits into from
Feb 3, 2025
8 changes: 8 additions & 0 deletions ydb/docs/en/core/reference/ydb-sdk/topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,8 @@ If a commit fails with an error, the application should log it and continue; it
}
```

The `Commit` call is fast by default, saving data into an internal buffer and returning control to the caller. The real message to the server is sent in the background. To prevent losing the last commits, call the `Reader.Close()` method before exiting the program.

- Python

```python
Expand All @@ -1391,6 +1393,8 @@ If a commit fails with an error, the application should log it and continue; it
reader.commit(message)
```

The `commit` call is fast, saving data into an internal buffer and returning control back to the caller. The real message to the server is sent in the background. To prevent losing the last commits, you should call the `Reader.Close()` method before exiting the program.

- Java

To commit a message just call `commit` method on it.
Expand Down Expand Up @@ -1451,6 +1455,8 @@ If a commit fails with an error, the application should log it and continue; it
}
```

The `Commit` call is fast by default, saving data into an internal buffer and returning control back to the caller. The real message to the server is sent in the background. To prevent losing the last commits, you should call the `Reader.Close()` method before exiting the program.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd better make it an {% include %} file instead of copypaste.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has two paragraph and two copy of each in one file. I need two additional files and four include options for deduplicate of them. The paragraph doesn't need in other files and replace the text to include option make read the text difficult when read it.

I think about small copy-paste better, then a lot of small files and combine them by includes.


- Python

```python
Expand All @@ -1460,6 +1466,8 @@ If a commit fails with an error, the application should log it and continue; it
reader.commit(batch)
```

The `commit` call is fast, saving data into an internal buffer and returning control back to the caller. The real message to the server is sent in the background. To prevent losing the last commits, you should call the `Reader.Close()` method before exiting the program.

- Java (sync)

Not relevant due to sync reader only reading messages one by one.
Expand Down
10 changes: 10 additions & 0 deletions ydb/docs/ru/core/reference/ydb-sdk/topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -1393,15 +1393,21 @@
}
```

По умолчанию `Commit` — это быстрый вызов: сохраняет данные во внутреннем буфере и сразу возвращает управление, а реальная отправка происходит позже. Поэтому, чтобы не терять последние коммиты перед выходом из программы, читателя нужно закрывать явно с помощью вызова `Reader.Close()`.

- Python

`commit` - это быстрый вызов: сохраняет данные во внутреннем буфере и сразу возвращает управление, а реальная отправка происходит позже. Поэтому, чтобы не терять последние коммиты перед выходом из программы, читателя нужно закрывать явно.

```python
while True:
message = reader.receive_message()
process(message)
reader.commit(message)
```

`commit` - это быстрый вызов: сохраняет данные во внутреннем буфере и сразу возвращает управление, а реальная отправка происходит позже. Поэтому, чтобы не терять последние коммиты перед выходом из программы, читателя нужно закрывать явно.

- Java

Для подтверждения обработки сообщения достаточно вызвать у сообщения метод `commit`.
Expand Down Expand Up @@ -1464,6 +1470,8 @@
}
```

По умолчанию `Commit` - это быстрый вызов: сохраняет данные во внутреннем буфере и сразу возвращает управление, а реальная отправка происходит позже. Поэтому, чтобы не терять последние коммиты перед выходом из программы, читателя нужно закрывать явно.

- Python

```python
Expand All @@ -1473,6 +1481,8 @@
reader.commit(batch)
```

`commit` - это быстрый вызов: сохраняет данные во внутреннем буфере и сразу возвращает управление, а реальная отправка происходит позже. Поэтому, чтобы не терять последние коммиты перед выходом из программы, читателя нужно закрывать явно.

- Java (sync)

Неактуально, т.к. в синхронном читателе нет возможности читать сообщения пакетами.
Expand Down
Loading