Package com.cognite.client.stream
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 Summary
Fields Modifier and Type Field Description protected AtomicBooleanabortStreamprotected static DurationDEFAULT_POLLING_INTERVALprotected static DurationDEFAULT_POLLING_OFFSETprotected org.slf4j.LoggerLOGprotected static InstantMAX_END_TIMEprotected static DurationMAX_POLLING_INTERVALprotected static DurationMAX_POLLING_OFFSETprotected static DurationMIN_POLLING_INTERVALprotected static DurationMIN_POLLING_OFFSETprotected static InstantMIN_START_TIMEprotected com.cognite.client.stream.AbstractPublisher.Statestate
-
Constructor Summary
Constructors Constructor Description AbstractPublisher()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidabort()Aborts the current stream operation.protected abstract InstantgetEndTime()protected abstract DurationgetPollingInterval()protected abstract DurationgetPollingOffset()protected abstract InstantgetStartTime()Future<Boolean>start()Starts the streaming job.
-
-
-
Field Detail
-
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
-
-
Method Detail
-
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 aFuturethat 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
truewhen the polling loop completes (at its specified end time).falseif 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.
-
-