• Stars
    star
    5
  • Rank 2,748,984 (Top 57 %)
  • Language
    Groovy
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This is a light weight extension of groovy's RESTClient to support asyn call via RxJava

Download

AsyncRestClient

This is a light weight extension of groovy's RESTClient to support asyn call via RxGroovy

Install:

dependencies {
        compile 'org.eginez.groovy:AsyncRestClient:1.+'
}

For RESTClient documentation: https://github.com/jgritman/httpbuilder/wiki/RESTClient. For RxGroovy documentation: https://github.com/ReactiveX/RxGroovy

Quick example:

with(AsyncRest) {
new RESTClient('https://google.com')
        .getAsync(path:'/')
        .subscribe { res -> println res.data }
        }

And of course harness the power of RxJava :D

with(AsyncRest){
Observable<Object>.zip(
    new RESTClient('http://someurl.com/part_1').getAsync(),
    new RESTClient('http://someurl.com/part_2').getAsync(),
    { res1, res2
        //proccess them eg:
        [res1.data: res2.data]
    })
    .subscribe { println '2 concurrent rest calls sync\'d for processing'}
    }