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

ratpack.kotlin.reactor.ReactorRatpackKotlin.kt Maven / Gradle / Ivy

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

import ratpack.exec.ExecController
import ratpack.exec.Operation
import ratpack.exec.Promise
import ratpack.func.Action
import ratpack.reactor.ReactorRatpack
import ratpack.registry.RegistrySpec
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono

/**
 * Reactor extension functions.
 */

/**
 * This will initialize error hooks so that exceptions are propagated as expected.
 */
fun initialize() = ReactorRatpack.initialize()

// convert promises to fluxes
fun  Promise.flux(): Flux = ReactorRatpack.flux(this)
fun Operation.flux(): Flux = ReactorRatpack.flux(this)
fun > Promise.fluxEach() = ReactorRatpack.fluxEach(this)

// convert promises to monos
fun  Promise.mono(): Mono = ReactorRatpack.mono(this)

// convert fluxes to promises
fun  Flux.promise() = ReactorRatpack.promise(this)

// convert monos to promises
fun  Mono.promiseSingle() = ReactorRatpack.promiseSingle(this)

// convert flowables to publishers
fun  Flux.publisher() = ReactorRatpack.publisher(this)

// flux thread binding
fun  Flux.bindExec() = ReactorRatpack.bindExec(this)

// flux execution forking
fun  Flux.fork() = ReactorRatpack.fork(this)
fun  Flux.fork(doWithRegistrySpec: Action) = ReactorRatpack.fork(this, doWithRegistrySpec)
fun  Flux.fork(doWithRegistrySpec: RegistrySpec.() -> Unit) = ReactorRatpack.fork(this, doWithRegistrySpec)
fun  Flux.forkEach() = ReactorRatpack.forkEach(this)
fun  Flux.forkEach(doWithRegistrySpec: Action) = ReactorRatpack.forkEach(this, doWithRegistrySpec)
fun  Flux.forkEach(doWithRegistrySpec: RegistrySpec.() -> Unit) = ReactorRatpack.forkEach(this, doWithRegistrySpec)

// schedulers
fun scheduler(execController: ExecController) = ReactorRatpack.computationScheduler(execController)
fun scheduler() = ReactorRatpack.computationScheduler()
fun ioScheduler(execController: ExecController) = ReactorRatpack.ioScheduler(execController)
fun ioScheduler() = ReactorRatpack.ioScheduler()







© 2015 - 2025 Weber Informatics LLC | Privacy Policy