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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    asyncReadEntries(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.
    boolean
     
    void
     
    protected org.apache.pulsar.broker.service.streamingdispatch.StreamingEntryReader.State
     
    void
    readEntryComplete(org.apache.bookkeeper.mledger.Entry entry, Object ctx)
     
    void
    readEntryFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, Object ctx)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StreamingEntryReader

      public StreamingEntryReader()
  • Method Details

    • asyncReadEntries

      public void asyncReadEntries(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.
      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

      public void readEntryComplete(org.apache.bookkeeper.mledger.Entry entry, Object ctx)
      Specified by:
      readEntryComplete in interface org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback
    • readEntryFailed

      public void readEntryFailed(org.apache.bookkeeper.mledger.ManagedLedgerException exception, Object ctx)
      Specified by:
      readEntryFailed in interface org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntryCallback
    • cancelReadRequests

      public boolean cancelReadRequests()
    • entriesAvailable

      public void entriesAvailable()
      Specified by:
      entriesAvailable in interface org.apache.bookkeeper.mledger.WaitingEntryCallBack
    • getState

      protected org.apache.pulsar.broker.service.streamingdispatch.StreamingEntryReader.State getState()