Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9682

camel-rx module should extend Bean Binding to support methods returning Observable<T>

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • Future
    • camel-rx
    • None
    • Unknown

    Description

      when making asynchronous InOut requests it'd be nice if methods could return Observable<T> so that we could use the RxJava async programming model to process async requests & responses.

      e.g. kinda like how folks can use Retrofit for HTTP: http://joluet.github.io/blog/2014/07/07/rxjava-retrofit/

      public interface MyThing {
      
      @GET("/session.json")
      Observable<LoginResponse> login();
      
      @GET("/user.json")
      Observable<UserState> getUserState();
      }
      

      to then let you use the normal composition / join / flatMap stuff in RxJava to compose multiple requests across different microservice invocations together with timeouts etc e.g. to compose the latest from 2 calls:

      Observable.combineLatest(api.fetchUserProfile(), api.getUserState(),
      (user, userStatus) -> new Pair<>(user, userStatus));
      

      Where we'd replace the @GET annotation with a bean binding annotation and a URI parameter to switch to using ActiveMQ or Twitter or whatever

      Attachments

        Activity

          People

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: