Registry / http-client / adapter-rxjava2

adapter-rxjava2

JSON →
library3.0.0javamavenunverified

A Retrofit CallAdapter that enables returning RxJava 2 Observable, Flowable, Single, Maybe, and Completable types from service methods.

<dependency> <groupId>com.squareup.retrofit2</groupId> <artifactId>adapter-rxjava2</artifactId> <version>3.0.0</version> </dependency>
INSTALL
IMPORT
SIG · ADAPTER-RXJAVA2
A
adapter-rxjava2
http-clientjavav3.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RxJava2CallAdapterFactory
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory

Configures Retrofit to use RxJava2 for asynchronous HTTP calls.

import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.http.GET; import io.reactivex.Observable; public class Example { interface Api { @GET("users") Observable<String> getUsers(); } public static void main(String[] args) { Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://api.example.com/") .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); Api api = retrofit.create(Api.class); api.getUsers().subscribe(System.out::println); } }
Debug
Known issues
breakingRetrofit 3.0 changed the package from retrofit2.adapter.rxjava2 to retrofit2.adapter.rxjava3 for RxJava3; this adapter is for RxJava2 only.
fix
If using RxJava3, use com.squareup.retrofit2:adapter-rxjava3 instead.
affects: >=3.0.0
Upgrade
Version history
3.0.0latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
49 hits · last 30 days
node
40
Perplexity
1
OpenAI (training)
1
Resources
adapter-rxjava2 — mvn dependency:get adapter-rxjava2 · libregistry