Skip to content

Commit

Permalink
Merge 34ce706 into 0e5d23d
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby authored Jan 17, 2025
2 parents 0e5d23d + 34ce706 commit 1a18aa3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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.

- 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

0 comments on commit 1a18aa3

Please sign in to comment.