Add Service instance to `Invocation`
See original GitHub issueWhat kind of issue is this?
-
Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn’t working the way you expect it to, use Stack Overflow. https://stackoverflow.com/questions/tagged/retrofit
-
Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9
-
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.
Since Retrofit supports service interface hierarchies, the method() & arguments() of the Invocation are no more sufficient to distinguish the invocation. A method might be declared in a super class with Retrofit annotations but the subclass is the interface which gets created.
interface Super {
@GET("/super") fun getSuper()
}
// This interface gets instantiated via Retrofit.create(Sub::class)
interface Sub: Super {
fun getSuperFallback(error: Throwable) { ... }
}
The primary use case right now is to be able to support/implement Resilience4j’s CircuitBreaker fallback mechanism but there are other library use cases and it might open the door to many others.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
I think we’ll add both the class and the instance.
soft bump ⬆️ @JakeWharton 😅