Class PublisherImpl (1.13.0)

public final class PublisherImpl extends ProxyService implements SequencedPublisher<Offset>, RetryingConnectionObserver<MessagePublishResponse>

Inheritance

java.lang.Object > AbstractApiService > ProxyService > PublisherImpl

Implements

com.google.cloud.pubsublite.internal.SequencedPublisher<com.google.cloud.pubsublite.Offset>, com.google.cloud.pubsublite.internal.wire.RetryingConnectionObserver<com.google.cloud.pubsublite.proto.MessagePublishResponse>

Constructors

PublisherImpl(StreamFactories.PublishStreamFactory streamFactory, InitialPublishRequest initialRequest, BatchingSettings batchingSettings)

public PublisherImpl(StreamFactories.PublishStreamFactory streamFactory, InitialPublishRequest initialRequest, BatchingSettings batchingSettings)
Parameters
NameDescription
streamFactoryStreamFactories.PublishStreamFactory
initialRequestInitialPublishRequest
batchingSettingsBatchingSettings

Methods

cancelOutstandingPublishes()

public void cancelOutstandingPublishes()

Attempts to cancel all outstanding publishes.

flush()

public void flush()

handlePermanentError(CheckedApiException error)

protected void handlePermanentError(CheckedApiException error)
Parameter
NameDescription
errorCheckedApiException
Overrides

onClientResponse(MessagePublishResponse publishResponse)

public void onClientResponse(MessagePublishResponse publishResponse)
Parameter
NameDescription
publishResponseMessagePublishResponse
Exceptions
TypeDescription
CheckedApiException

publish(PubSubMessage message, PublishSequenceNumber sequenceNumber)

public ApiFuture<Offset> publish(PubSubMessage message, PublishSequenceNumber sequenceNumber)

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.

Parameters
NameDescription
messagePubSubMessage
sequenceNumberPublishSequenceNumber
Returns
TypeDescription
ApiFuture<Offset>

start()

protected void start()
Overrides

stop()

protected void stop()
Overrides

triggerReinitialize(CheckedApiException streamError)

public void triggerReinitialize(CheckedApiException streamError)
Parameter
NameDescription
streamErrorCheckedApiException