public final class PublisherImpl extends ProxyService implements SequencedPublisher<Offset>, RetryingConnectionObserver<MessagePublishResponse>
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>Inherited Members
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 |
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 |
start()
protected void start()
stop()
protected void stop()
triggerReinitialize(CheckedApiException streamError)
public void triggerReinitialize(CheckedApiException streamError)
Parameter | |
---|---|
Name | Description |
streamError |
CheckedApiException |