Class PublisherImpl (1.13.8)

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
Name Description
streamFactory StreamFactories.PublishStreamFactory
initialRequest InitialPublishRequest
batchingSettings BatchingSettings

Methods

cancelOutstandingPublishes()

public void cancelOutstandingPublishes()

Attempts to cancel all outstanding publishes.

flush()

public void flush()

handlePermanentError(CheckedApiException error)

protected void handlePermanentError(CheckedApiException error)
Parameter
Name Description
error CheckedApiException
Overrides

onClientResponse(MessagePublishResponse publishResponse)

public void onClientResponse(MessagePublishResponse publishResponse)
Parameter
Name Description
publishResponse MessagePublishResponse
Exceptions
Type Description
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
Name Description
message PubSubMessage
sequenceNumber PublishSequenceNumber
Returns
Type Description
ApiFuture<Offset>

start()

protected void start()
Overrides

stop()

protected void stop()
Overrides

triggerReinitialize(CheckedApiException streamError)

public void triggerReinitialize(CheckedApiException streamError)
Parameter
Name Description
streamError CheckedApiException