Class StreamingEntryReader
java.lang.Object
org.apache.pulsar.broker.service.streamingdispatch.StreamingEntryReader
- All Implemented Interfaces:
org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback,org.apache.bookkeeper.mledger.WaitingEntryCallBack
public class StreamingEntryReader
extends Object
implements org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback, org.apache.bookkeeper.mledger.WaitingEntryCallBack
Entry reader that fulfill read request by streamline the read instead of reading with micro batch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidasyncReadEntries(int numEntriesToRead, long maxReadSizeByte, Object ctx) Read entries in streaming way, that said instead of reading with micro batch and send entries to consumer after all entries in the batch are read from ledger, this method will fire numEntriesToRead requests to managedLedger and send entry to consumer whenever it is read and all entries before it have been sent to consumer.booleanvoidprotected org.apache.pulsar.broker.service.streamingdispatch.StreamingEntryReader.StategetState()voidreadEntryComplete(org.apache.bookkeeper.mledger.Entry entry, Object ctx) voidreadEntryFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, Object ctx)
-
Constructor Details
-
StreamingEntryReader
public StreamingEntryReader()
-
-
Method Details
-
asyncReadEntries
Read entries in streaming way, that said instead of reading with micro batch and send entries to consumer after all entries in the batch are read from ledger, this method will fire numEntriesToRead requests to managedLedger and send entry to consumer whenever it is read and all entries before it have been sent to consumer.- Parameters:
numEntriesToRead- number of entry to read from ledger.maxReadSizeByte- maximum byte will be read from ledger.ctx- Context send along with read request.
-
readEntryComplete
- Specified by:
readEntryCompletein interfaceorg.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback
-
readEntryFailed
public void readEntryFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, Object ctx) - Specified by:
readEntryFailedin interfaceorg.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback
-
cancelReadRequests
public boolean cancelReadRequests() -
entriesAvailable
public void entriesAvailable()- Specified by:
entriesAvailablein interfaceorg.apache.bookkeeper.mledger.WaitingEntryCallBack
-
getState
protected org.apache.pulsar.broker.service.streamingdispatch.StreamingEntryReader.State getState()
-