Skip to content
This repository has been archived by the owner on Apr 10, 2021. It is now read-only.

drmaas/ratpack-rx2

Repository files navigation

ratpack-rx2

Ratpack support for rxjava2

Gradle

compile 'me.drmaas:ratpack-rx2:x.x.x'

Maven

<dependency>
    <groupId>me.drmaas</groupId>
    <artifactId>ratpack-rx2</artifactId>
    <version>x.x.x/version>
</dependency>

Examples

Observable

ratpack {
  handlers {
    get(":value") {
      observe(Blocking.get {
        pathTokens.value
      }).promiseSingle().then {
        render it
      }
    }
  }
}

Flowable

ratpack {
  handlers {
    get(":value") {
      flow(Blocking.get {
        pathTokens.value
      }, BackpressureStrategy.BUFFER).promiseSingle().then {
        render it
      }
    }
  }
}

Single

ratpack {
  handlers {
    get(":value") {
      single(Blocking.get {
        pathTokens.value
      }).promiseSingle().then {
        render it
      }
    }
  }
}

Maybe

ratpack {
  handlers {
    get(":value") {
      maybe(Blocking.get {
        pathTokens.value
      }).promiseSingle().then {
        render it
      }
    }
  }
}

A detailed listing of use cases should follow logically from those documentated at https://ratpack.io/manual/current/api/ratpack/rx/RxRatpack.html