Skip to content

Commit c460968

Browse files
committed
fix usage deprecations in examples
1 parent 043ba77 commit c460968

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

examples/topic/topicreader/topicreader_advanced.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ func UnmarshalMessageContentToOwnType(ctx context.Context, reader *topicreader.R
5050
// ProcessMessagesWithSyncCommit example about guarantee wait for commit accepted by server
5151
func ProcessMessagesWithSyncCommit(ctx context.Context, db *ydb.Driver) {
5252
reader, _ := db.Topic().StartReader("consumer", nil,
53-
topicoptions.WithCommitMode(topicoptions.CommitModeSync),
53+
topicoptions.WithReaderCommitMode(topicoptions.CommitModeSync),
5454
)
5555
defer func() {
5656
_ = reader.Close(ctx)
5757
}()
5858

5959
for {
60-
batch, _ := reader.ReadMessageBatch(ctx)
60+
batch, _ := reader.ReadMessagesBatch(ctx)
6161
processBatch(batch.Context(), batch)
6262
_ = reader.Commit(ctx, batch) // will wait response about commit from server
6363
}
@@ -67,7 +67,7 @@ func ProcessMessagesWithSyncCommit(ctx context.Context, db *ydb.Driver) {
6767
// commit messages to YDB
6868
func OwnReadProgressStorage(ctx context.Context, db *ydb.Driver) {
6969
reader, _ := db.Topic().StartReader("consumer", topicoptions.ReadTopic("asd"),
70-
topicoptions.WithGetPartitionStartOffset(
70+
topicoptions.WithReaderGetPartitionStartOffset(
7171
func(
7272
ctx context.Context,
7373
req topicoptions.GetPartitionStartOffsetRequest,
@@ -84,7 +84,7 @@ func OwnReadProgressStorage(ctx context.Context, db *ydb.Driver) {
8484
)
8585

8686
for {
87-
batch, _ := reader.ReadMessageBatch(ctx)
87+
batch, _ := reader.ReadMessagesBatch(ctx)
8888

8989
processBatch(batch.Context(), batch)
9090
_ = externalSystemCommit(

examples/topic/topicreader/topicreader_simple.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func PrintMessageContent(ctx context.Context, reader *topicreader.Reader) {
2424
// ReadMessagesByBatch it is recommended way for process messages
2525
func ReadMessagesByBatch(ctx context.Context, reader *topicreader.Reader) {
2626
for {
27-
batch, _ := reader.ReadMessageBatch(ctx)
27+
batch, _ := reader.ReadMessagesBatch(ctx)
2828
processBatch(batch.Context(), batch)
2929
_ = reader.Commit(batch.Context(), batch)
3030
}

examples/topic/topicreader/topicreader_trace.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func ExplicitPartitionStartStopHandler(ctx context.Context, db *ydb.Driver) {
7171
}()
7272

7373
for {
74-
batch, _ := reader.ReadMessageBatch(readContext)
74+
batch, _ := reader.ReadMessagesBatch(readContext)
7575

7676
processBatch(batch.Context(), batch)
7777
_ = externalSystemCommit(
@@ -129,8 +129,7 @@ func PartitionStartStopHandlerAndOwnReadProgressStorage(ctx context.Context, db
129129
}
130130

131131
r, _ := db.Topic().StartReader("consumer", topicoptions.ReadTopic("asd"),
132-
133-
topicoptions.WithGetPartitionStartOffset(readStartPosition),
132+
topicoptions.WithReaderGetPartitionStartOffset(readStartPosition),
134133
topicoptions.WithReaderTrace(
135134
trace.Topic{
136135
OnReaderPartitionReadStartResponse: onPartitionStart,
@@ -144,7 +143,7 @@ func PartitionStartStopHandlerAndOwnReadProgressStorage(ctx context.Context, db
144143
}()
145144

146145
for {
147-
batch, _ := r.ReadMessageBatch(readContext)
146+
batch, _ := r.ReadMessagesBatch(readContext)
148147

149148
processBatch(batch.Context(), batch)
150149
_ = externalSystemCommit(batch.Context(), batch.Topic(), batch.PartitionID(), getEndOffset(batch))

examples/topic/topicwriter/topicwriter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ func ConnectSimple(ctx context.Context, db *ydb.Driver) *topicwriter.Writer {
1717
}
1818

1919
func ConnectWithSyncWrite(ctx context.Context, db *ydb.Driver) *topicwriter.Writer {
20-
writer, _ := db.Topic().StartWriter("topicName", topicoptions.WithSyncWrite(true))
20+
writer, _ := db.Topic().StartWriter("topicName", topicoptions.WithWriterWaitServerAck(true))
2121

2222
return writer
2323
}
2424

2525
func ConnectSelectCodec(ctx context.Context, db *ydb.Driver) *topicwriter.Writer {
26-
writer, _ := db.Topic().StartWriter("topicName", topicoptions.WithCodec(topictypes.CodecGzip))
26+
writer, _ := db.Topic().StartWriter("topicName", topicoptions.WithWriterCodec(topictypes.CodecGzip))
2727

2828
return writer
2929
}

0 commit comments

Comments
 (0)