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 void
cancelOutstandingPublishes()
Attempts to cancel all outstanding publishes.void
flush()
protected void
handlePermanentError(CheckedApiException error)
void
onClientResponse(MessagePublishResponse publishResponse)
com.google.api.core.ApiFuture<Offset>
publish(PubSubMessage message, PublishSequenceNumber sequenceNumber)
Publish a new message with an assigned sequence number.protected void
start()
protected void
stop()
void
triggerReinitialize(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:
triggerReinitialize
in interfaceRetryingConnectionObserver<MessagePublishResponse>
-
handlePermanentError
protected void handlePermanentError(CheckedApiException error)
- Overrides:
handlePermanentError
in classProxyService
-
start
protected void start()
- Overrides:
start
in classProxyService
-
stop
protected void stop()
- Overrides:
stop
in classProxyService
-
publish
public com.google.api.core.ApiFuture<Offset> publish(PubSubMessage message, PublishSequenceNumber sequenceNumber)
Description copied from interface:SequencedPublisher
Publish 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:
publish
in interfaceSequencedPublisher<Offset>
-
cancelOutstandingPublishes
public void cancelOutstandingPublishes()
Description copied from interface:SequencedPublisher
Attempts to cancel all outstanding publishes.- Specified by:
cancelOutstandingPublishes
in interfaceSequencedPublisher<Offset>
-
onClientResponse
public void onClientResponse(MessagePublishResponse publishResponse) throws CheckedApiException
- Specified by:
onClientResponse
in interfaceRetryingConnectionObserver<MessagePublishResponse>
- Throws:
CheckedApiException
-
-