cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Commented] (CXF-6833) support RxJava Observable<T> in return values as a more composeable alternative to Future<T>
Date Wed, 16 Mar 2016 11:40:33 GMT


Sergey Beryozkin commented on CXF-6833:

Thanks, FYI, this is what was proposed for JAX-RS 2.1:

I haven't looked deeply into it yet due to the 2.1 process being quite slow, but from what
I understood, that API was designed to work the alternative 3rd party libraries too. I hope
we can start reasonably soon (few months time frame) with the client side first and then move
to supporting it as an extension on the server side.  I don't mind starting before the spec
produces something more specific, it is just difficult to allocate a chunk of time for it
right now.  

> support RxJava Observable<T> in return values as a more composeable alternative
to Future<T>
> --------------------------------------------------------------------------------------------
>                 Key: CXF-6833
>                 URL:
>             Project: CXF
>          Issue Type: Improvement
>            Reporter: james strachan
> when invoking multiple REST services concurrently in a microservice kinda world it can
be really helpful to use RxJava's Observable<T> so that you can easily compose concurrent
asynchronous requests together.
> e.g. see this blog:
> Its basically about using RxJava's Observable<T> as the result type; which is a
little like a Future<T> but can handle streams of values and is composable.
> It would be great to do this both on the client and server side; as a server may invoke
multiple asynchronous back ends and return a composition of results etc.
> e.g.
> {code}
> @GET("/session.json")
> Observable<LoginResponse> login();
> @GET("/user.json")
> Observable<UserState> getUserState();
> {code}
> you can then use the Observable<T> composition methods to join / flatMap  to compose
multiple requests across different microservice invocations together with timeouts etc e.g.
to compose the latest from 2 calls:
> {code}
> Observable.combineLatest(api.fetchUserProfile(), api.getUserState(),
> (user, userStatus) -> new Pair<>(user, userStatus));
> {code}
> and you're done! There's support for timeouts and other kinds of composition mechanisms

This message was sent by Atlassian JIRA

View raw message