ydb-platform / ydb-java-sdk

YDB Java SDK
https://ydb.tech
Apache License 2.0
36 stars 18 forks source link

Add WriteAcks as a result of the SyncWriter operations #280

Open Eistern opened 3 months ago

Eistern commented 3 months ago

Problem

Currently, the tech.ydb.topic.write.SyncWriter interface does not provide any technical means for users to receive and analyze the results of their send(...) operations. This lack of functionality can make it difficult for developers to ensure that their messages are being sent successfully and to troubleshoot any issues that may arise.

Proposed solution

Propagate the results of sendImpl(...).join() to the user code

Eistern commented 3 months ago

PR published - https://github.com/ydb-platform/ydb-java-sdk/pull/281 (for some reason it didn’t link automatically)

pnv1 commented 3 months ago

This was made on purpose to keep sync interface simple and not to overload it with CompletableFutures. AsyncWriter does exactly what you want.

Eistern commented 3 months ago

This was made on purpose to keep sync interface simple and not to overload it with CompletableFutures. AsyncWriter does exactly what you want.

There is a slight issue. We need the blocking behavior of the internal writer queue that is provided by the SyncWriter (and implementing logic on top of the tech.ydb.topic.write.QueueOverflowException is not a good idea in terms of performance). Currently, we've declared our own extension of the tech.ydb.topic.write.impl.WriterImpl to do just that, but it is still a hassle to properly open it without the use of the tech.ydb.topic.TopicClient

pnv1 commented 3 months ago

We need the blocking behavior of the internal writer queue that is provided by the SyncWriter (and implementing logic on top of the tech.ydb.topic.write.QueueOverflowException is not a good idea in terms of performance).

Ok, I got your concerns. We need some time to consider