@BetaApi(value="The surface for streaming is not stable yet and may change in the future.")
public interface StreamResumptionStrategy<RequestT,ResponseT>
Implementations don't have to be threadsafe because all of the calls will be serialized.
| 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. |
@Nonnull StreamResumptionStrategy<RequestT,ResponseT> createNew()
@Nonnull ResponseT processResponse(ResponseT response)
ServerStreamingAttemptCallable when a response has been successfully
received. This method accomplishes two goals:
@Nullable RequestT getResumeRequest(RequestT originalRequest)
boolean canResume()