Java Code Examples for io.reactivex.Observable#fromPublisher()

The following examples show how to use io.reactivex.Observable#fromPublisher() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public <T> Observable<T> performRequestObservable(final Type type, final NextcloudRequest request) {
    return Observable.fromPublisher( s-> {
        try {
            s.onNext(performRequest(type, request));
            s.onComplete();
        } catch (Exception e) {
            s.onError(e);
        }
    });
}
 
Example 2
public <T> Observable<ParsedResponse<T>> performRequestObservableV2(final Type type, final NextcloudRequest request) {
    return Observable.fromPublisher( s-> {
        try {
            Response response = performNetworkRequestV2(request);
            s.onNext(ParsedResponse.of(convertStreamToTargetEntity(response.getBody(), type), response.getPlainHeaders()));
            s.onComplete();
        } catch (Exception e) {
            s.onError(e);
        }
    });
}
 
Example 3
Source Project: smallrye-mutiny   File: ToObservable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Observable<T> apply(Uni<T> uni) {
    return Observable.fromPublisher(uni.convert().toPublisher());
}
 
Example 4
Source Project: smallrye-mutiny   File: ToObservable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Observable<T> apply(Multi<T> multi) {
    return Observable.fromPublisher(multi);
}
 
Example 5
@Override
public Observable fromPublisher(Publisher publisher) {
    return Observable.fromPublisher(publisher);
}