public class SyncReaderImpl extends ReaderImpl implements SyncReader
id, isReconnecting, isStopped, reconnectCounter| Constructor and Description |
|---|
SyncReaderImpl(TopicRpc topicRpc,
ReaderSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
handleClosePartitionSession(PartitionSession partitionSession) |
protected void |
handleCommitResponse(long committedOffset,
PartitionSession partitionSession) |
protected CompletableFuture<Void> |
handleDataReceivedEvent(DataReceivedEvent event) |
protected void |
handleStartPartitionSessionRequest(tech.ydb.proto.topic.YdbTopic.StreamReadMessage.StartPartitionSessionRequest request,
PartitionSession partitionSession,
Consumer<StartPartitionSessionSettings> confirmCallback) |
protected void |
handleStopPartitionSession(tech.ydb.proto.topic.YdbTopic.StreamReadMessage.StopPartitionSessionRequest request,
Long partitionId,
Runnable confirmCallback) |
void |
init()
Initialize reading in the background.
|
void |
initAndWait()
Initialize internal threads and wait for server init response.
|
Message |
receive()
Receive a
Message. |
Message |
receive(long timeout,
TimeUnit unit)
Receive a
Message. |
void |
shutdown()
Stops internal threads and makes cleanup in background.
|
getLogger, getStreamName, initImpl, onShutdown, onStreamReconnectonSessionClosed, shutdownImpl, shutdownImplpublic SyncReaderImpl(TopicRpc topicRpc, ReaderSettings settings)
public void init()
SyncReaderinit in interface SyncReaderpublic void initAndWait()
SyncReaderinitAndWait in interface SyncReader@Nullable public Message receive(long timeout, TimeUnit unit) throws InterruptedException
SyncReaderMessage. Blocks until a Message is received.
Throws TimeoutException if timeout runs offreceive in interface SyncReadertimeout - timeout to wait a Message withunit - TimeUnit for timeoutMessage, or null if the specified waiting time elapses before a message is availableInterruptedExceptionpublic Message receive() throws InterruptedException
SyncReaderMessage. Blocks until a Message is received.receive in interface SyncReaderMessageInterruptedExceptionprotected CompletableFuture<Void> handleDataReceivedEvent(DataReceivedEvent event)
handleDataReceivedEvent in class ReaderImplprotected void handleCommitResponse(long committedOffset,
PartitionSession partitionSession)
handleCommitResponse in class ReaderImplprotected void handleStartPartitionSessionRequest(tech.ydb.proto.topic.YdbTopic.StreamReadMessage.StartPartitionSessionRequest request,
PartitionSession partitionSession,
Consumer<StartPartitionSessionSettings> confirmCallback)
handleStartPartitionSessionRequest in class ReaderImplprotected void handleStopPartitionSession(tech.ydb.proto.topic.YdbTopic.StreamReadMessage.StopPartitionSessionRequest request,
@Nullable
Long partitionId,
Runnable confirmCallback)
handleStopPartitionSession in class ReaderImplprotected void handleClosePartitionSession(PartitionSession partitionSession)
handleClosePartitionSession in class ReaderImplpublic void shutdown()
SyncReadershutdown in interface SyncReaderCopyright © 2024. All rights reserved.