@BetaApi(value="The surface for streaming is not stable yet and may change in the future.") public final class SimpleStreamResumptionStrategy<RequestT,ResponseT> extends Object implements StreamResumptionStrategy<RequestT,ResponseT>
StreamResumptionStrategy which returns the initial request
for unstarted streams.| Constructor and Description |
|---|
SimpleStreamResumptionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canResume()
If a resume request can be created.
|
StreamResumptionStrategy<RequestT,ResponseT> |
createNew()
Creates a new instance of this StreamResumptionStrategy without accumulated state
|
RequestT |
getResumeRequest(RequestT originalRequest)
Called when a stream needs to be restarted, the implementation should generate a request that
will yield a new stream whose first response would come right after the last response received
by processResponse.
|
ResponseT |
processResponse(ResponseT response)
Called by the
ServerStreamingAttemptCallable when a response has been successfully
received. |
public StreamResumptionStrategy<RequestT,ResponseT> createNew()
StreamResumptionStrategycreateNew in interface StreamResumptionStrategy<RequestT,ResponseT>public ResponseT processResponse(ResponseT response)
StreamResumptionStrategyServerStreamingAttemptCallable when a response has been successfully
received. This method accomplishes two goals:
processResponse in interface StreamResumptionStrategy<RequestT,ResponseT>public RequestT getResumeRequest(RequestT originalRequest)
StreamResumptionStrategygetResumeRequest in interface StreamResumptionStrategy<RequestT,ResponseT>public boolean canResume()
StreamResumptionStrategycanResume in interface StreamResumptionStrategy<RequestT,ResponseT>