From c757f59b6d52d47bb29694fbd35720a8070d4a3b Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Thu, 5 Sep 2024 16:02:43 +0000 Subject: [PATCH 01/11] add read in trunsaction in russian --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index 1893f7318c5f..ed4685efb31a 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -1636,6 +1636,28 @@ } ``` +- Go + + [Пример на Github](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) + + Для чтение сообщений внутри транзакции нужно воспользоваться методом [Reader.PopBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3@v3.79.0/topic/topicreader#Reader.PopBatchTx). Он прочитает пакет сообщений и добавит их их коммит в транзакцию, отдельно коммитить эти сообщения не нужно. + + ```go + err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + batch, err := reader.PopBatchTx(ctx, tx) + if err != nil { + return err + } + + batchResult, err := processBatch(batch.Context(), batch) + if err != nil { + return err + } + + return nil + } + ``` + - Java (sync) [Пример на GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionReadSync.java) From f89943d0c8f212bbbca12c86c84d22b6fba22a22 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Thu, 5 Sep 2024 16:51:35 +0000 Subject: [PATCH 02/11] notify --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index ed4685efb31a..40ab82fa4613 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -1646,18 +1646,24 @@ err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { batch, err := reader.PopBatchTx(ctx, tx) if err != nil { - return err - } + return err + } batchResult, err := processBatch(batch.Context(), batch) if err != nil { - return err - } + return err + } return nil } ``` + {% note info %} + + В Go SDK имеет смысл читать сообщения в самом начале транзации до других операций, т.к. транзакции query-сервиса сделаны "ленивыми" и серверная сущность не создаётся до первого обращения в транзакцию. Читатель учитывает эту особенность и не открывает реальную транзакцию до получения сообщений. Особенно это имеет смысл при маленьком потоке сообщений когда очередного сообщения SDK может ждать долго. + + {% endnote %} + - Java (sync) [Пример на GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionReadSync.java) From a18ef3cff70a7baba7542ab83bb58c40ba1b5397 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Mon, 23 Sep 2024 13:10:23 +0000 Subject: [PATCH 03/11] tx topic go sdk --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 31 +++++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index 910ff80f7ca7..6fff96413a90 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -859,6 +859,24 @@ transaction.Commit().GetValueSync(); ``` +- Go + + Для записи в топик в транзакции нужно создать транзакционного писателя, после этого писать сообщения можно как обычно. Закрывать транзакционного + писателя не нужно - это делается автоматически при завершении транзакции. + + [Пример на Github](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) + + ```go + err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + writer, err := db.Topic().StartTransactionalWriter(tx, topicName) + if err != nil { + return err + } + + return writer.Write(ctx, topicwriter.Message{Data: strings.NewReader("asd")}) + }) + ``` + - Java (sync) [Пример на GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionWriteSync.java) @@ -1674,22 +1692,17 @@ [Пример на Github](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) - Для чтение сообщений внутри транзакции нужно воспользоваться методом [Reader.PopBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3@v3.79.0/topic/topicreader#Reader.PopBatchTx). Он прочитает пакет сообщений и добавит их их коммит в транзакцию, отдельно коммитить эти сообщения не нужно. + Для чтение сообщений внутри транзакции нужно воспользоваться методом [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx). Он прочитает пакет сообщений и добавит их их коммит в транзакцию, отдельно коммитить эти сообщения не нужно. Читателя сообщений можно переиспользовать между разными транзакциями, в этом случае нужно чтобы порядок коммита транзакций соответствовал порядку получения сообщений из читателя, т.к. коммиты сообщений в топике должны идти строго по-порядку. ```go err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { - batch, err := reader.PopBatchTx(ctx, tx) + batch, err := reader.PopMessagesBatchTx(ctx, tx) if err != nil { return err } - batchResult, err := processBatch(batch.Context(), batch) - if err != nil { - return err - } - - return nil - } + return processBatch(ctx, batch) + }) ``` {% note info %} From 521b6e1ba247158275270296124063c8d7f7ce12 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Mon, 23 Sep 2024 13:30:04 +0000 Subject: [PATCH 04/11] fix github linter --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index 6fff96413a90..dfa577a6f1b1 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -864,7 +864,7 @@ Для записи в топик в транзакции нужно создать транзакционного писателя, после этого писать сообщения можно как обычно. Закрывать транзакционного писателя не нужно - это делается автоматически при завершении транзакции. - [Пример на Github](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) + [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) ```go err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { @@ -1690,7 +1690,7 @@ - Go - [Пример на Github](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) + [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) Для чтение сообщений внутри транзакции нужно воспользоваться методом [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx). Он прочитает пакет сообщений и добавит их их коммит в транзакцию, отдельно коммитить эти сообщения не нужно. Читателя сообщений можно переиспользовать между разными транзакциями, в этом случае нужно чтобы порядок коммита транзакций соответствовал порядку получения сообщений из читателя, т.к. коммиты сообщений в топике должны идти строго по-порядку. From a01ffbc7607397ce8b8e56a2cc593740e89f01b5 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Mon, 23 Sep 2024 15:46:04 +0000 Subject: [PATCH 05/11] style fixes, add english --- ydb/docs/en/core/reference/ydb-sdk/topic.md | 42 +++++++++++++++++++++ ydb/docs/ru/core/reference/ydb-sdk/topic.md | 31 +++++++-------- 2 files changed, 56 insertions(+), 17 deletions(-) diff --git a/ydb/docs/en/core/reference/ydb-sdk/topic.md b/ydb/docs/en/core/reference/ydb-sdk/topic.md index df11d3363117..f40285a0acd8 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -849,6 +849,25 @@ All the metadata provided when writing a message is sent to a consumer with the {% list tabs %} +- Go + + Для записи в топик в транзакции необходимо создать транзакционного писателя, после чего можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. + + To write to a topic within a transaction, you need to create a transactional writer by calling [TopicClient.StartTransactionalWriter](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic#Client.StartTransactionalWriter) with the tx argument. Once created, you can write messages as usual. There's no need to close the transactional writer manually - it will be closed automatically when the transaction ends. + + [Example on GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) + + ```go + err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + writer, err := db.Topic().StartTransactionalWriter(tx, topicName) + if err != nil { + return err + } + + return writer.Write(ctx, topicwriter.Message{Data: strings.NewReader("asd")}) + }) + ``` + - Java (sync) [Example on GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionWriteSync.java) @@ -1656,6 +1675,29 @@ Reading progress is usually saved on a server for each Consumer. However, such p } ``` +- Go + + To read messages from a topic within a transaction, you need to use [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx) method. It reads a batch of messages and adds commit the commit to the transaction, so there's no need to commit them separately. You can reuse the reader across different transactions. However, it's important to commit transactions in the same order as the messages are read from the reader, as message commits in the topic must be performed strictly in order.The simplest way to ensure this is by using the reader within a loop. + + + [Example on GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) + + ```go + for { + err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + batch, err := reader.PopMessagesBatchTx(ctx, tx) // батч закоммитится при общем коммите транзакции + if err != nil { + return err + } + + return processBatch(ctx, batch) + }) + if err != nil { + handleError(err) + } + } + ``` + - Java (sync) [Example on GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionReadSync.java) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index dfa577a6f1b1..963fe339c247 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -860,9 +860,7 @@ ``` - Go - - Для записи в топик в транзакции нужно создать транзакционного писателя, после этого писать сообщения можно как обычно. Закрывать транзакционного - писателя не нужно - это делается автоматически при завершении транзакции. + Для записи в топик в транзакции необходимо создать транзакционного писателя, после чего можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) @@ -1690,27 +1688,26 @@ - Go - [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) + Для чтения сообщений в рамках транзакции следует использовать метод [`Reader.PopMessagesBatchTx`](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx). Он прочитает пакет сообщений и добавит их коммит в транзакцию, при этом отдельно коммитить эти сообщения не требуется. Читателя сообщений можно использовать повторно в разных транзакциях. При этом важно, чтобы порядок коммита транзакций соответствовал порядку получения сообщений от читателя, так как коммиты сообщений в топике должны выполняться строго по порядку. Проще всего это сделать если использовать читателя в цикле. - Для чтение сообщений внутри транзакции нужно воспользоваться методом [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx). Он прочитает пакет сообщений и добавит их их коммит в транзакцию, отдельно коммитить эти сообщения не нужно. Читателя сообщений можно переиспользовать между разными транзакциями, в этом случае нужно чтобы порядок коммита транзакций соответствовал порядку получения сообщений из читателя, т.к. коммиты сообщений в топике должны идти строго по-порядку. + [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) ```go - err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { - batch, err := reader.PopMessagesBatchTx(ctx, tx) + for { + err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { + batch, err := reader.PopMessagesBatchTx(ctx, tx) // батч закоммитится при общем коммите транзакции + if err != nil { + return err + } + + return processBatch(ctx, batch) + }) if err != nil { - return err + handleError(err) } - - return processBatch(ctx, batch) - }) + } ``` - {% note info %} - - В Go SDK имеет смысл читать сообщения в самом начале транзации до других операций, т.к. транзакции query-сервиса сделаны "ленивыми" и серверная сущность не создаётся до первого обращения в транзакцию. Читатель учитывает эту особенность и не открывает реальную транзакцию до получения сообщений. Особенно это имеет смысл при маленьком потоке сообщений когда очередного сообщения SDK может ждать долго. - - {% endnote %} - - Java (sync) [Пример на GitHub](https://github.com/ydb-platform/ydb-java-examples/blob/develop/ydb-cookbook/src/main/java/tech/ydb/examples/topic/transactions/TransactionReadSync.java) From 5da0ffaeff83a79b35e56419ac8993d0613f7c0c Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:32:24 +0300 Subject: [PATCH 06/11] Update ydb/docs/en/core/reference/ydb-sdk/topic.md Co-authored-by: Ivan Blinkov --- ydb/docs/en/core/reference/ydb-sdk/topic.md | 2 -- 1 file changed, 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 f40285a0acd8..04e790d1049d 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -851,8 +851,6 @@ All the metadata provided when writing a message is sent to a consumer with the - Go - Для записи в топик в транзакции необходимо создать транзакционного писателя, после чего можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. - To write to a topic within a transaction, you need to create a transactional writer by calling [TopicClient.StartTransactionalWriter](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic#Client.StartTransactionalWriter) with the tx argument. Once created, you can write messages as usual. There's no need to close the transactional writer manually - it will be closed automatically when the transaction ends. [Example on GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) From 6156dfbff3f0b7962a873bdb06d2a499cac84906 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:32:43 +0300 Subject: [PATCH 07/11] Update ydb/docs/en/core/reference/ydb-sdk/topic.md Co-authored-by: Ivan Blinkov --- ydb/docs/en/core/reference/ydb-sdk/topic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ydb/docs/en/core/reference/ydb-sdk/topic.md b/ydb/docs/en/core/reference/ydb-sdk/topic.md index 04e790d1049d..a58c71e9dbde 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -851,7 +851,7 @@ All the metadata provided when writing a message is sent to a consumer with the - Go - To write to a topic within a transaction, you need to create a transactional writer by calling [TopicClient.StartTransactionalWriter](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic#Client.StartTransactionalWriter) with the tx argument. Once created, you can write messages as usual. There's no need to close the transactional writer manually - it will be closed automatically when the transaction ends. + To write to a topic within a transaction, create a transactional writer by calling [TopicClient.StartTransactionalWriter](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic#Client.StartTransactionalWriter) with the `tx` argument. Once created, you can send messages as usual. There's no need to close the transactional writer manually, as it will be closed automatically when the transaction ends. [Example on GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) From bdb9b01af57b90565c22f75f5b27f1e08c9171a5 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:33:03 +0300 Subject: [PATCH 08/11] Update ydb/docs/en/core/reference/ydb-sdk/topic.md Co-authored-by: Ivan Blinkov --- ydb/docs/en/core/reference/ydb-sdk/topic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ydb/docs/en/core/reference/ydb-sdk/topic.md b/ydb/docs/en/core/reference/ydb-sdk/topic.md index a58c71e9dbde..1fee67f08a82 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -1675,7 +1675,7 @@ Reading progress is usually saved on a server for each Consumer. However, such p - Go - To read messages from a topic within a transaction, you need to use [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx) method. It reads a batch of messages and adds commit the commit to the transaction, so there's no need to commit them separately. You can reuse the reader across different transactions. However, it's important to commit transactions in the same order as the messages are read from the reader, as message commits in the topic must be performed strictly in order.The simplest way to ensure this is by using the reader within a loop. + To read messages from a topic within a transaction, use the [Reader.PopMessagesBatchTx](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader#Reader.PopMessagesBatchTx) method. It reads a batch of messages and adds their commit to the transaction, so there's no need to commit them separately. The reader can be reused across different transactions. However, it's important to commit transactions in the same order as the messages are read from the reader, as message commits in the topic must be performed strictly in order. The simplest way to ensure this is by using the reader within a loop. [Example on GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicreader/topic_reader_transaction.go) From bd50e62705f55c7477004ca7ed8962250ce373b4 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:33:12 +0300 Subject: [PATCH 09/11] Update ydb/docs/en/core/reference/ydb-sdk/topic.md Co-authored-by: Ivan Blinkov --- ydb/docs/en/core/reference/ydb-sdk/topic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ydb/docs/en/core/reference/ydb-sdk/topic.md b/ydb/docs/en/core/reference/ydb-sdk/topic.md index 1fee67f08a82..d44078c7fb10 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/en/core/reference/ydb-sdk/topic.md @@ -1683,7 +1683,7 @@ Reading progress is usually saved on a server for each Consumer. However, such p ```go for { err := db.Query().DoTx(ctx, func(ctx context.Context, tx query.TxActor) error { - batch, err := reader.PopMessagesBatchTx(ctx, tx) // батч закоммитится при общем коммите транзакции + batch, err := reader.PopMessagesBatchTx(ctx, tx) // the batch will be committed along with the transaction if err != nil { return err } From 5d52341c3b54b72fd5895c7d5df214bd7b2ab38c Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:33:23 +0300 Subject: [PATCH 10/11] Update ydb/docs/ru/core/reference/ydb-sdk/topic.md Co-authored-by: Ivan Blinkov --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index 963fe339c247..162677e04e9c 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -860,6 +860,7 @@ ``` - Go + Для записи в топик в транзакции необходимо создать транзакционного писателя, после чего можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go) From 6933a365762b37ba15e4814c5f84c4ba76fd79b7 Mon Sep 17 00:00:00 2001 From: Timofey Koolin Date: Tue, 24 Sep 2024 07:37:02 +0300 Subject: [PATCH 11/11] Update ydb/docs/ru/core/reference/ydb-sdk/topic.md --- ydb/docs/ru/core/reference/ydb-sdk/topic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ydb/docs/ru/core/reference/ydb-sdk/topic.md b/ydb/docs/ru/core/reference/ydb-sdk/topic.md index 162677e04e9c..8b07d9866d56 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/topic.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/topic.md @@ -861,7 +861,7 @@ - Go - Для записи в топик в транзакции необходимо создать транзакционного писателя, после чего можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. + Для записи в топик в транзакции необходимо создать транзакционного писателя через вызов [TopicClient.StartTransactionalWriter](https://pkg.go.dev/github.com/ydb-platform/ydb-go-sdk/v3/topic#Client.StartTransactionalWriter). После этого можно отправлять сообщения, как обычно. Закрывать транзакционного писателя не требуется — это происходит автоматически при завершении транзакции. [Пример на GitHub](https://github.com/ydb-platform/ydb-go-sdk/blob/master/examples/topic/topicwriter/topic_writer_transaction.go)