This is part of the server streaming retry api. Its implementers are responsible for tracking the
progress of the stream and calculating a request to resume it in case of an error.
Implementations don't have to be threadsafe because all of the calls will be serialized.
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.
Called by the ServerStreamingAttemptCallable when a response has been successfully
received. This method accomplishes two goals:
It allows the strategy implementation to update its internal state so that it can compose
the resume request
It allows the strategy to alter the incoming responses to adjust for after resume. For
example, if the responses are numbered sequentially from the start of the stream, upon
resume, the strategy could rewrite the messages to continue the sequence from where it
left off. Please note that all messages (even for the first attempt) will be passed
through this method.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe latest version available for \u003ccode\u003eStreamResumptionStrategy\u003c/code\u003e is 2.63.1, as part of the server streaming retry API, with a comprehensive list of prior versions ranging from 2.62.0 back to 2.7.1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStreamResumptionStrategy\u003c/code\u003e implementers are designed to manage the progress of a stream and formulate a request to continue the stream in the event of an error.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecanResume()\u003c/code\u003e method determines if a resume request can be generated, while \u003ccode\u003ecreateNew()\u003c/code\u003e instantiates a new \u003ccode\u003eStreamResumptionStrategy\u003c/code\u003e without any retained state.\u003c/p\u003e\n"],["\u003cp\u003eThe method \u003ccode\u003egetResumeRequest(RequestT originalRequest)\u003c/code\u003e is invoked when a stream must restart, prompting the implementation to produce a request that yields a new stream that starts after the last received response.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eprocessResponse(ResponseT response)\u003c/code\u003e is used by \u003ccode\u003eServerStreamingAttemptCallable\u003c/code\u003e when a response is successfully received, allowing the strategy to update internal state for composing resume requests and modify incoming responses.\u003c/p\u003e\n"]]],[],null,["# Interface StreamResumptionStrategy<RequestT,ResponseT> (2.69.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.69.0 (latest)](/java/docs/reference/gax/latest/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.68.2](/java/docs/reference/gax/2.68.2/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.67.0](/java/docs/reference/gax/2.67.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.66.0](/java/docs/reference/gax/2.66.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.65.0](/java/docs/reference/gax/2.65.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.63.1](/java/docs/reference/gax/2.63.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.62.0](/java/docs/reference/gax/2.62.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.61.0](/java/docs/reference/gax/2.61.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.60.0](/java/docs/reference/gax/2.60.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.59.1](/java/docs/reference/gax/2.59.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.58.0](/java/docs/reference/gax/2.58.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.57.0](/java/docs/reference/gax/2.57.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.55.0](/java/docs/reference/gax/2.55.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.54.1](/java/docs/reference/gax/2.54.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.53.0](/java/docs/reference/gax/2.53.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.52.0](/java/docs/reference/gax/2.52.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.51.0](/java/docs/reference/gax/2.51.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.50.0](/java/docs/reference/gax/2.50.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.49.0](/java/docs/reference/gax/2.49.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.48.1](/java/docs/reference/gax/2.48.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.47.0](/java/docs/reference/gax/2.47.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.46.1](/java/docs/reference/gax/2.46.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.45.0](/java/docs/reference/gax/2.45.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.43.0](/java/docs/reference/gax/2.43.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.42.0](/java/docs/reference/gax/2.42.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.41.0](/java/docs/reference/gax/2.41.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.39.0](/java/docs/reference/gax/2.39.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.38.0](/java/docs/reference/gax/2.38.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.37.0](/java/docs/reference/gax/2.37.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.36.0](/java/docs/reference/gax/2.36.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.35.0](/java/docs/reference/gax/2.35.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.34.1](/java/docs/reference/gax/2.34.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.33.0](/java/docs/reference/gax/2.33.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.32.1](/java/docs/reference/gax/2.32.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.31.1](/java/docs/reference/gax/2.31.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.30.1](/java/docs/reference/gax/2.30.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.24.0](/java/docs/reference/gax/2.24.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.23.3](/java/docs/reference/gax/2.23.3/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.22.0](/java/docs/reference/gax/2.22.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.21.0](/java/docs/reference/gax/2.21.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.20.1](/java/docs/reference/gax/2.20.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.19.6](/java/docs/reference/gax/2.19.6/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.18.7](/java/docs/reference/gax/2.18.7/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.17.0](/java/docs/reference/gax/2.17.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.16.0](/java/docs/reference/gax/2.16.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.15.0](/java/docs/reference/gax/2.15.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.14.0](/java/docs/reference/gax/2.14.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.13.0](/java/docs/reference/gax/2.13.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.12.2](/java/docs/reference/gax/2.12.2/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.11.0](/java/docs/reference/gax/2.11.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.10.0](/java/docs/reference/gax/2.10.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.9.0](/java/docs/reference/gax/2.9.0/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.8.1](/java/docs/reference/gax/2.8.1/com.google.api.gax.retrying.StreamResumptionStrategy)\n- [2.7.1](/java/docs/reference/gax/2.7.1/com.google.api.gax.retrying.StreamResumptionStrategy) \n\n public interface StreamResumptionStrategy\u003cRequestT,ResponseT\u003e\n\nThis is part of the server streaming retry api. Its implementers are responsible for tracking the\nprogress of the stream and calculating a request to resume it in case of an error.\n\nImplementations don't have to be threadsafe because all of the calls will be serialized.\n\nMethods\n-------\n\n### canResume()\n\n public abstract boolean canResume()\n\nIf a resume request can be created.\n\n### createNew()\n\n public abstract StreamResumptionStrategy\u003cRequestT,ResponseT\u003e createNew()\n\nCreates a new instance of this StreamResumptionStrategy without accumulated state\n\n### getResumeRequest(RequestT originalRequest)\n\n public abstract RequestT getResumeRequest(RequestT originalRequest)\n\nCalled when a stream needs to be restarted, the implementation should generate a request that\nwill yield a new stream whose first response would come right after the last response received\nby processResponse.\n\n### processResponse(ResponseT response)\n\n public abstract ResponseT processResponse(ResponseT response)\n\nCalled by the `ServerStreamingAttemptCallable` when a response has been successfully\nreceived. This method accomplishes two goals:\n\n1. It allows the strategy implementation to update its internal state so that it can compose the resume request\n2. It allows the strategy to alter the incoming responses to adjust for after resume. For example, if the responses are numbered sequentially from the start of the stream, upon resume, the strategy could rewrite the messages to continue the sequence from where it left off. Please note that all messages (even for the first attempt) will be passed through this method."]]