Class PublisherImpl
java.lang.Object
com.google.api.core.AbstractApiService
com.google.cloud.pubsublite.internal.ProxyService
com.google.cloud.pubsublite.internal.wire.PublisherImpl
- All Implemented Interfaces:
com.google.api.core.ApiService,SequencedPublisher<Offset>,RetryingConnectionObserver<MessagePublishResponse>,Flushable
public final class PublisherImpl
extends ProxyService
implements SequencedPublisher<Offset>, RetryingConnectionObserver<MessagePublishResponse>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.api.core.ApiService
com.google.api.core.ApiService.Listener, com.google.api.core.ApiService.State -
Constructor Summary
ConstructorsConstructorDescriptionPublisherImpl(StreamFactories.PublishStreamFactory streamFactory, InitialPublishRequest initialRequest, com.google.api.gax.batching.BatchingSettings batchingSettings) -
Method Summary
Modifier and TypeMethodDescriptionvoidAttempts to cancel all outstanding publishes.voidflush()protected voidvoidonClientResponse(MessagePublishResponse publishResponse) com.google.api.core.ApiFuture<Offset>publish(PubSubMessage message, PublishSequenceNumber sequenceNumber) Publish a new message with an assigned sequence number.protected voidstart()protected voidstop()voidtriggerReinitialize(CheckedApiException streamError) Methods inherited from class com.google.cloud.pubsublite.internal.ProxyService
addServices, addServices, doStart, doStop, onPermanentErrorMethods inherited from class com.google.api.core.AbstractApiService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.api.core.ApiService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Constructor Details
-
PublisherImpl
public PublisherImpl(StreamFactories.PublishStreamFactory streamFactory, InitialPublishRequest initialRequest, com.google.api.gax.batching.BatchingSettings batchingSettings) throws com.google.api.gax.rpc.ApiException - Throws:
com.google.api.gax.rpc.ApiException
-
-
Method Details
-
triggerReinitialize
- Specified by:
triggerReinitializein interfaceRetryingConnectionObserver<MessagePublishResponse>
-
handlePermanentError
- Overrides:
handlePermanentErrorin classProxyService
-
start
protected void start()- Overrides:
startin classProxyService
-
stop
protected void stop()- Overrides:
stopin classProxyService
-
publish
public com.google.api.core.ApiFuture<Offset> publish(PubSubMessage message, PublishSequenceNumber sequenceNumber) Description copied from interface:SequencedPublisherPublish a new message with an assigned sequence number.Behavior is undefined if a call to flush() is outstanding or close() has already been called. This method never blocks.
Guarantees that if a single publish future has an exception set, all publish calls made after that will also have an exception set.
- Specified by:
publishin interfaceSequencedPublisher<Offset>
-
cancelOutstandingPublishes
public void cancelOutstandingPublishes()Description copied from interface:SequencedPublisherAttempts to cancel all outstanding publishes.- Specified by:
cancelOutstandingPublishesin interfaceSequencedPublisher<Offset>
-
flush
public void flush() -
onClientResponse
- Specified by:
onClientResponsein interfaceRetryingConnectionObserver<MessagePublishResponse>- Throws:
CheckedApiException
-