com.gojek.courier.Stream.kt Maven / Gradle / Ivy
package com.gojek.courier
import org.reactivestreams.Publisher
/**
* An sequence of asynchronous values of type `T` that is used to emit [Message].
*
* A Stream is lazy. It may be started by [start].
*/
interface Stream : Publisher {
fun start(observer: Observer): Disposable
/**
* Observes a [Stream].
*/
interface Observer {
/**
* Data notification.
*/
fun onNext(data: T)
/**
* Failed terminal state.
*/
fun onError(throwable: Throwable)
/**
* Successful terminal state.
*/
fun onComplete()
}
interface Disposable {
fun dispose()
fun isDisposed(): Boolean
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy