public final class ReactorCallAdapterFactory
extends retrofit2.CallAdapter.Factory
Adding this class to Retrofit allows you to return a Flux or Mono from
service methods.
interface MyService {
@GET("user/me")
Flux<User> getUser()
}
There are three configurations supported for the Flux or Mono type
parameter:
Flux<User>) calls onNext with the deserialized body for
2XX responses and calls onError with HttpException for non-2XX
responses and IOException for network errors.Flux<Response<User>>) calls onNext with a
Response object for all HTTP responses and calls onError with IOException
for network errorsFlux<Result<User>>) calls onNext with a
Result object for all HTTP responses and errors.| Modifier and Type | Method and Description |
|---|---|
static ReactorCallAdapterFactory |
create()
Returns an instance which creates synchronous observables that do not operate on any scheduler
by default.
|
static ReactorCallAdapterFactory |
createAsync()
Returns an instance which creates asynchronous observables.
|
static ReactorCallAdapterFactory |
createWithScheduler(reactor.core.scheduler.Scheduler scheduler)
Returns an instance which creates synchronous observables that
publishes on
scheduler by default. |
retrofit2.CallAdapter<?,?> |
get(java.lang.reflect.Type returnType,
java.lang.annotation.Annotation[] annotations,
retrofit2.Retrofit retrofit) |
public static ReactorCallAdapterFactory create()
public static ReactorCallAdapterFactory createAsync()
Flux.subscribeOn(reactor.core.scheduler.Scheduler) has no effect on stream types created by this factory.public static ReactorCallAdapterFactory createWithScheduler(reactor.core.scheduler.Scheduler scheduler)
scheduler by default.public retrofit2.CallAdapter<?,?> get(java.lang.reflect.Type returnType,
java.lang.annotation.Annotation[] annotations,
retrofit2.Retrofit retrofit)
get in class retrofit2.CallAdapter.Factory