ratpack.kotlin.rx2.RxRatpackKotlin.kt Maven / Gradle / Ivy
package ratpack.kotlin.rx2
import io.reactivex.BackpressureStrategy
import io.reactivex.Flowable
import io.reactivex.FlowableOnSubscribe
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.Single
import ratpack.exec.ExecController
import ratpack.exec.Operation
import ratpack.exec.Promise
import ratpack.func.Action
import ratpack.registry.RegistrySpec
import ratpack.rx2.RxRatpack
/**
* RxJava2 extension functions.
* see https://ratpack.io/manual/current/api/ratpack/rx/RxRatpack.html for details.
*/
/**
* @see RxRatpack.initialize
*/
fun initialize() = RxRatpack.initialize()
// convert promises to observables
fun Promise.observe(): Observable = RxRatpack.observe(this)
fun Operation.observe(): Observable = RxRatpack.observe(this)
fun > Promise.observeEach() = RxRatpack.observeEach(this)
// convert observables to promises
fun Observable.promise() = RxRatpack.promise(this)
fun ObservableOnSubscribe.promise() = RxRatpack.promise(this)
fun Observable.promiseSingle() = RxRatpack.promiseSingle(this)
fun ObservableOnSubscribe.promiseSingle() = RxRatpack.promiseSingle(this)
fun Single.promiseSingle() = RxRatpack.promiseSingle(this)
// convert observables to publishers
fun Observable.publisher(strategy: BackpressureStrategy) = RxRatpack.publisher(this, strategy)
fun ObservableOnSubscribe.publisher(strategy: BackpressureStrategy) = RxRatpack.publisher(this, strategy)
// observable thread binding
fun Observable.bindExec() = RxRatpack.bindExec(this)
fun Observable.fork() = RxRatpack.fork(this)
fun Observable.fork(doWithRegistrySpec: Action) = RxRatpack.fork(this, doWithRegistrySpec)
fun Observable.fork(doWithRegistrySpec: RegistrySpec.() -> Unit) = RxRatpack.fork(this, doWithRegistrySpec)
fun Observable.forkEach() = RxRatpack.forkEach(this)
fun Observable.forkEach(doWithRegistrySpec: Action) = RxRatpack.forkEach(this, doWithRegistrySpec)
fun Observable.forkEach(doWithRegistrySpec: RegistrySpec.() -> Unit) = RxRatpack.forkEach(this, doWithRegistrySpec)
// convert promises to flowables
fun Promise.flow(strategy: BackpressureStrategy): Flowable = RxRatpack.flow(this, strategy)
fun Operation.flow(strategy: BackpressureStrategy): Flowable = RxRatpack.flow(this, strategy)
fun > Promise.flowEach(strategy: BackpressureStrategy) = RxRatpack.flowEach(this, strategy)
// convert flowables to promises
fun Flowable.promise() = RxRatpack.promise(this)
fun FlowableOnSubscribe.promise(strategy: BackpressureStrategy) = RxRatpack.promise(this, strategy)
fun Flowable.promiseSingle() = RxRatpack.promiseSingle(this)
fun FlowableOnSubscribe.promiseSingle(strategy: BackpressureStrategy) = RxRatpack.promiseSingle(this, strategy)
// convert flowables to publishers
fun Flowable.publisher() = RxRatpack.publisher(this)
fun FlowableOnSubscribe.publisher(strategy: BackpressureStrategy) = RxRatpack.publisher(this, strategy)
// flowable thread binding
fun Flowable.bindExec(strategy: BackpressureStrategy) = RxRatpack.bindExec(this, strategy)
fun Flowable.fork(strategy: BackpressureStrategy) = RxRatpack.fork(this, strategy)
fun Flowable.fork(doWithRegistrySpec: Action, strategy: BackpressureStrategy) = RxRatpack.fork(this, strategy, doWithRegistrySpec)
fun Flowable.fork(doWithRegistrySpec: RegistrySpec.() -> Unit, strategy: BackpressureStrategy) = RxRatpack.fork(this, strategy, doWithRegistrySpec)
fun Flowable.forkEach() = RxRatpack.forkEach(this)
fun Flowable.forkEach(doWithRegistrySpec: Action) = RxRatpack.forkEach(this, doWithRegistrySpec)
fun Flowable.forkEach(doWithRegistrySpec: RegistrySpec.() -> Unit) = RxRatpack.forkEach(this, doWithRegistrySpec)
// schedulers
fun scheduler(execController: ExecController) = RxRatpack.scheduler(execController)
fun scheduler() = RxRatpack.scheduler()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy