All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ratpack.kotlin.rx2.RxRatpackKotlin.kt Maven / Gradle / Ivy

There is a newer version: 1.10.3
Show newest version
package ratpack.kotlin.rx2

import io.reactivex.BackpressureStrategy
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.Single
import io.reactivex.SingleOnSubscribe
import ratpack.exec.ExecController
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() = RxRatpack.observe(this)

// convert singles to promises
fun  Single.promise() = RxRatpack.promise(this)
fun  SingleOnSubscribe.promise() = RxRatpack.promise(this)

// convert observables to promises
fun  Observable.promiseAll() = RxRatpack.promiseAll(this)
fun  ObservableOnSubscribe.promiseAll() = RxRatpack.promiseAll(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)

// forking
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 promise to single
fun  Promise.single(): Single = RxRatpack.single(this)

// schedulers
fun scheduler(execController: ExecController) = RxRatpack.scheduler(execController)

fun scheduler() = RxRatpack.scheduler()







© 2015 - 2024 Weber Informatics LLC | Privacy Policy