userver: ydb::TopicWriteSession Class Reference
Loading...
Searching...
No Matches
ydb::TopicWriteSession Class Referencefinal

#include <userver/ydb/topic.hpp>

Detailed Description

Write session used to connect to a topic for writting.

See also
https://ydb.tech/docs/en/reference/ydb-sdk/topic#write

Definition at line 81 of file topic.hpp.

Public Member Functions

NYdb::NTopic::TWriteSessionEvent::TEvent GetEvent ()
 Wait for the next write session event.
 
std::optional< NYdb::NTopic::TWriteSessionEvent::TEvent > TryGetEvent ()
 Poll for a write session event without waiting.
 
void Write (NYdb::NTopic::TContinuationToken &&token, NYdb::NTopic::TWriteMessage &&message)
 Write a messsage using a continuation token from TReadyToAcceptEvent.
 
bool Close (std::chrono::milliseconds timeout)
 Close write session.
 
NYdb::NTopic::IWriteSession & GetNativeTopicWriteSession ()
 Get native write session.
 

Member Function Documentation

◆ Close()

bool ydb::TopicWriteSession::Close ( std::chrono::milliseconds timeout)

Close write session.

Waits for all in-flights messages to be acknowledged. Force closes after timeout

◆ GetEvent()

NYdb::NTopic::TWriteSessionEvent::TEvent ydb::TopicWriteSession::GetEvent ( )

Wait for the next write session event.

Suspends the current coroutine until an event is available, then returns it without blocking the thread.

◆ GetNativeTopicWriteSession()

NYdb::NTopic::IWriteSession & ydb::TopicWriteSession::GetNativeTopicWriteSession ( )

Get native write session.

Warning
Use with care! Facilities from userver/drivers/subscribable_futures.hpp can help with non-blocking wait operations.

◆ TryGetEvent()

std::optional< NYdb::NTopic::TWriteSessionEvent::TEvent > ydb::TopicWriteSession::TryGetEvent ( )

Poll for a write session event without waiting.

Returns the next buffered event immediately if one is available, or std::nullopt if the event queue is empty. Does not suspend the coroutine.

Note
Sometimes may return std::nullopt even if an event is available. Intended for use in loops.

◆ Write()

void ydb::TopicWriteSession::Write ( NYdb::NTopic::TContinuationToken && token,
NYdb::NTopic::TWriteMessage && message )

Write a messsage using a continuation token from TReadyToAcceptEvent.

Must be called only after receiving TReadyToAcceptEvent from GetEvent() or TryGetEvent().


The documentation for this class was generated from the following file: