Class AbstractPublisher

java.lang.Object
com.cognite.client.stream.AbstractPublisher
Direct Known Subclasses:
Publisher, RawPublisher

public abstract class AbstractPublisher extends Object
Abstract superclass for streaming publishers. It holds key constants and variables.
  • Field Details

    • MIN_POLLING_INTERVAL

      protected static final Duration MIN_POLLING_INTERVAL
    • DEFAULT_POLLING_INTERVAL

      protected static final Duration DEFAULT_POLLING_INTERVAL
    • MAX_POLLING_INTERVAL

      protected static final Duration MAX_POLLING_INTERVAL
    • MIN_POLLING_OFFSET

      protected static final Duration MIN_POLLING_OFFSET
    • DEFAULT_POLLING_OFFSET

      protected static final Duration DEFAULT_POLLING_OFFSET
    • MAX_POLLING_OFFSET

      protected static final Duration MAX_POLLING_OFFSET
    • MIN_START_TIME

      protected static final Instant MIN_START_TIME
    • MAX_END_TIME

      protected static final Instant MAX_END_TIME
    • LOG

      protected final org.slf4j.Logger LOG
    • abortStream

      protected AtomicBoolean abortStream
    • state

      protected com.cognite.client.stream.AbstractPublisher.State state
  • Constructor Details

    • AbstractPublisher

      public AbstractPublisher()
  • Method Details

    • getPollingInterval

      protected abstract Duration getPollingInterval()
    • getPollingOffset

      protected abstract Duration getPollingOffset()
    • getStartTime

      protected abstract Instant getStartTime()
    • getEndTime

      protected abstract Instant getEndTime()
    • start

      public Future<Boolean> start()
      Starts the streaming job. The job is executed on a separate thread and this method will immediately return to the caller. It returns a Future that you can use to block the execution of your own code if you want to explicitly wait for completion of the streaming job.
      Returns:
      A Future hosting the end state of the streaming job. The future returns true when the polling loop completes (at its specified end time). false if the job is aborted before the specified end time.
    • abort

      public void abort()
      Aborts the current stream operation. It may take a few seconds for this operation to complete.