#include <userver/ydb/topic.hpp>
Native YDB producer used for partition-aware writes to a topic.
Unlike TopicSimpleWriteSession, this is a wrapper around the YDB SDK IProducer. It selects partitions by message key or explicit partition and manages the corresponding write sessions internally.
Write() fails immediately if the internal buffer is overloaded.
Public Member Functions | |
| NYdb::NTopic::TWriteResult | Write (NYdb::NTopic::TWriteMessage &&message) |
| Write a single message to the topic. | |
| NYdb::NTopic::TFlushResult | Flush (engine::Deadline deadline={}) |
| Flush all buffered messages to the server. | |
| NYdb::NTopic::TCloseResult | Close (std::chrono::milliseconds timeout) |
| Close the producer. | |
| NYdb::NTopic::IProducer & | GetNativeTopicProducer () |
| Get native producer. | |
| NYdb::NTopic::TCloseResult ydb::TopicProducer::Close | ( | std::chrono::milliseconds | timeout | ) |
Close the producer.
Waits for all in-flight messages to be acknowledged. Force closes after timeout.
| NYdb::NTopic::TFlushResult ydb::TopicProducer::Flush | ( | engine::Deadline | deadline = {} | ) |
Flush all buffered messages to the server.
Waits until all in-flight messages are acknowledged.
| deadline | timeout for flush completion |
| NYdb::NTopic::IProducer & ydb::TopicProducer::GetNativeTopicProducer | ( | ) |
Get native producer.
| NYdb::NTopic::TWriteResult ydb::TopicProducer::Write | ( | NYdb::NTopic::TWriteMessage && | message | ) |
Write a single message to the topic.
Adds the message to the internal buffer and returns its queueing status. Fails immediately with EWriteStatus::Timeout if the buffer is full. Use Flush() to wait for the buffered messages to be persistently written.