You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
already exists! Don’t send pull requests to implement new features without first getting our
support. Sometimes we leave features out on purpose to keep the project small.
So we were implementing the fault-tolerance system for our Android application based on storing the low-level request data in SQLite and process the stored requests in a background. After consideration we came to the point where we will only store the method, url and body of the request, relying on our interceptors to add the API/Auth tokens.
We do not want to store the data that will rely on our code, so it is not okay for us to use the retrofit annotated API-services and instead we require low-level calls, such as:
val request =Request.Builder()
.url(queuedRequest.url)
.method(queuedRequest.method, queuedRequest.body.toRequestBody())
val response = retrofit.callFactory().newCall(request).execute()
It does the thing and it works correctly with all the interceptors that enrich the request with the tokens. However, we also use retrofit-specific CallAdapters we run into the issue. In our case we only use the Retry policy from resilience4j.retrofit and it is being bootstrapped by Retrofit.Builder().addCallAdapterFactory(RetryCallAdapter.of(apiRetry)). So when we call the callFactory() it returns the OkHttp low-level call factory that is oblivious to any call adapters that we have. It is not the biggest deal and we work it around with
val supplier =Retry.decorateSupplier(RemoteDataModule.apiRetry) {
val response = retrofit.callFactory().newCall(request).execute()
if (response.isSuccessful) {
Response.success(response.code, response.body.toString())
} else {
Response.error(response.code, response.body!!)
}
}
But of course it only looks okay-ish because we only use one call adapter, and, for example, no CircuitBreaker so far.
So the problem is - is there a way to make a low-level calls to the whole retrofit instance without using the annotated service? Is it a proper feature request?
Thanks in advance,
Best regards :)
The text was updated successfully, but these errors were encountered:
What kind of issue is this?
already exists! Don’t send pull requests to implement new features without first getting our
support. Sometimes we leave features out on purpose to keep the project small.
So we were implementing the fault-tolerance system for our Android application based on storing the low-level request data in SQLite and process the stored requests in a background. After consideration we came to the point where we will only store the method, url and body of the request, relying on our interceptors to add the API/Auth tokens.
We do not want to store the data that will rely on our code, so it is not okay for us to use the retrofit annotated API-services and instead we require low-level calls, such as:
It does the thing and it works correctly with all the interceptors that enrich the request with the tokens. However, we also use retrofit-specific CallAdapters we run into the issue. In our case we only use the Retry policy from
resilience4j.retrofit
and it is being bootstrapped byRetrofit.Builder().addCallAdapterFactory(RetryCallAdapter.of(apiRetry))
. So when we call thecallFactory()
it returns the OkHttp low-level call factory that is oblivious to any call adapters that we have. It is not the biggest deal and we work it around withBut of course it only looks okay-ish because we only use one call adapter, and, for example, no CircuitBreaker so far.
So the problem is - is there a way to make a low-level calls to the whole retrofit instance without using the annotated service? Is it a proper feature request?
Thanks in advance,
Best regards :)
The text was updated successfully, but these errors were encountered: