Is creating multiple Retrofit service instances okay? One per module; lets say 20 overall; given the okhttp instance is shared?
Or should I rather strive for a single big retrofit instance and have it extend some partial interfaces, so it then can get injected behind it?
s
satyan
07/18/2020, 1:39 PM
I can't see any drawbacks in using multiple retrofit services if they share the same http client, I would even argue it's the opposite. I allows to separate your entities API's in several interfaces. 🤷
o
OG
07/18/2020, 3:49 PM
^ agreed
u
ursus
07/18/2020, 4:44 PM
ok, but you do share the rest adapters? i.e.
val restAdapter = Retrofit.Builder()...build()
?
s
satyan
07/18/2020, 8:37 PM
You'll have one retrofit instance (if you have one base URL) and several generated services.
u
ursus
07/18/2020, 8:38 PM
yea, I thought retrofit instances were cheap so I spammed them as the generated services, only sharing the okhttp