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

com.gojek.courier.Stream.kt Maven / Gradle / Ivy

There is a newer version: 0.3.1
Show newest version
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