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>
-
-
Constructor Summary
Constructors Constructor Description PublisherImpl(StreamFactories.PublishStreamFactory streamFactory, InitialPublishRequest initialRequest, com.google.api.gax.batching.BatchingSettings batchingSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelOutstandingPublishes()Attempts to cancel all outstanding publishes.voidflush()protected voidhandlePermanentError(CheckedApiException error)voidonClientResponse(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, onPermanentError
-
Methods inherited from class com.google.api.core.AbstractApiService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync
-
-
-
-
Constructor Detail
-
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 Detail
-
triggerReinitialize
public void triggerReinitialize(CheckedApiException streamError)
- Specified by:
triggerReinitializein interfaceRetryingConnectionObserver<MessagePublishResponse>
-
handlePermanentError
protected void handlePermanentError(CheckedApiException error)
- 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>
-
onClientResponse
public void onClientResponse(MessagePublishResponse publishResponse) throws CheckedApiException
- Specified by:
onClientResponsein interfaceRetryingConnectionObserver<MessagePublishResponse>- Throws:
CheckedApiException
-
-