Package cz.o2.proxima.direct.io.pubsub
Class AbstractPubSubReader
- java.lang.Object
-
- cz.o2.proxima.core.storage.AbstractStorage
-
- cz.o2.proxima.direct.io.pubsub.AbstractPubSubReader
-
- Direct Known Subclasses:
PubSubBulkReader
public abstract class AbstractPubSubReader extends AbstractStorage
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cz.o2.proxima.core.storage.AbstractStorage
AbstractStorage.SerializableAbstractStorage
-
-
Field Summary
Fields Modifier and Type Field Description protected PubSubAccessoraccessorprotected Contextcontextprotected intmaxAckDeadlineprotected java.lang.Stringprojectprotected intsubscriptionAckDeadlineprotected booleansubscriptionAutoCreateprotected java.lang.Stringtopicprotected WatermarkEstimatorFactorywatermarkFactory
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPubSubReader(EntityDescriptor entityDesc, java.net.URI uri, PubSubAccessor accessor, Context context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<Partition>getPartitions()booleanhasExternalizableOffsets()ObserveHandleobserve(java.lang.String name, Position position, CommitLogObserver observer)ObserveHandleobserveBulk(java.lang.String name, Position position, boolean stopAtCurrent, CommitLogObserver observer)Observe PubSub in a bulk fashion.ObserveHandleobserveBulkOffsets(java.util.Collection<Offset> offsets, boolean stopAtCurrent, CommitLogObserver observer)ObserveHandleobserveBulkPartitions(java.lang.String name, java.util.Collection<Partition> partitions, Position position, boolean stopAtCurrent, CommitLogObserver observer)ObserveHandleobservePartitions(java.lang.String name, java.util.Collection<Partition> partitions, Position position, boolean stopAtCurrent, CommitLogObserver observer)protected abstract java.util.List<StreamElement>parseElements(com.google.pubsub.v1.PubsubMessage m)-
Methods inherited from class cz.o2.proxima.core.storage.AbstractStorage
equals, hashCode
-
-
-
-
Field Detail
-
accessor
protected final PubSubAccessor accessor
-
context
protected final Context context
-
project
protected final java.lang.String project
-
topic
protected final java.lang.String topic
-
maxAckDeadline
protected final int maxAckDeadline
-
subscriptionAckDeadline
protected final int subscriptionAckDeadline
-
subscriptionAutoCreate
protected final boolean subscriptionAutoCreate
-
watermarkFactory
protected final WatermarkEstimatorFactory watermarkFactory
-
-
Constructor Detail
-
AbstractPubSubReader
protected AbstractPubSubReader(EntityDescriptor entityDesc, java.net.URI uri, PubSubAccessor accessor, Context context)
-
-
Method Detail
-
getPartitions
public java.util.List<Partition> getPartitions()
-
observe
public ObserveHandle observe(@Nullable java.lang.String name, Position position, CommitLogObserver observer)
-
observePartitions
public ObserveHandle observePartitions(@Nullable java.lang.String name, java.util.Collection<Partition> partitions, Position position, boolean stopAtCurrent, CommitLogObserver observer)
-
observeBulk
public ObserveHandle observeBulk(@Nullable java.lang.String name, Position position, boolean stopAtCurrent, CommitLogObserver observer)
Observe PubSub in a bulk fashion. Note that due to current PubSub implementation the bulk commit must happen before the ack timeout. If the message is not acknowledged before this timeout the message will be redelivered, which will result in duplicate messages.- Parameters:
name- name of the observer subscriptionposition- must be set to NEWESTstopAtCurrent- throwUnsupportedOperationExceptionwhentrueobserver- the observer of data- Returns:
- handle to interact with the observation thread
-
observeBulkPartitions
public ObserveHandle observeBulkPartitions(@Nullable java.lang.String name, java.util.Collection<Partition> partitions, Position position, boolean stopAtCurrent, CommitLogObserver observer)
-
observeBulkOffsets
public ObserveHandle observeBulkOffsets(java.util.Collection<Offset> offsets, boolean stopAtCurrent, CommitLogObserver observer)
-
parseElements
protected abstract java.util.List<StreamElement> parseElements(com.google.pubsub.v1.PubsubMessage m)
-
hasExternalizableOffsets
public boolean hasExternalizableOffsets()
-
-