Class AbstractTwitterReader

Direct Known Subclasses:
TwitterFilterStreamReader, TwitterFollowerReader, TwitterFollowingReader, TwitterSearchReader, TwitterTimelineReader

public abstract class AbstractTwitterReader extends IntegrationReader
Base class for Twitter API v2 readers; each page from search() yields one record per data element.
  • Field Details

  • Constructor Details

    • AbstractTwitterReader

      public AbstractTwitterReader(TwitterCredentials twitterCredentials)
  • Method Details

    • search

      protected abstract Response search()
      Requests the next page of results (see getNextToken()); returning null ends reading.
    • getMaxResults

      public int getMaxResults()
      Indicates the maximum number of records that will be obtained by the endpoint.
    • setMaxResults

      public AbstractTwitterReader setMaxResults(int maxResults)
      Indicates the maximum number of records that will be obtained by the endpoint.
    • getNextToken

      protected String getNextToken()
      Returns the pagination token for the next request: empty before the first page and null once no pages remain.
    • readImpl

      protected Record readImpl() throws Throwable
      Description copied from class: DataReader
      Overridden by subclasses to read the next record from this DataReader. The default implementation of DataReader.read() now insures that this method will not be called again after it returns a null.

      If no record is available, null will be returned.

      Contract for subclasses (see also docs/authoring/DataReader.md):

      Specified by:
      readImpl in class DataReader
      Throws:
      Throwable
    • readNextBatch

      protected boolean readNextBatch() throws Throwable
      Buffers the records of the next search() page; returns false when there is no further page to read.
      Throws:
      Throwable
    • setException

      protected DataException setException(DataException exception)
      Stores an exception for the next read to throw and returns it.
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class DataReader