Target filter
Search Kotlin docs
  • Back
  • Tealium Prism Kotlin SDK Reference
core/com.tealium.prism.core.api.pubsub/Observable

Observable

interface Observable<T> : Subscribable<T>

Base class for observable implementations - provides methods for built in intermediate operations.

Inheritors

ObservableState
Subject

Functions

asSingle
Link copied to clipboard
open fun asSingle(scheduler: Scheduler): Single<T>

Converts this Observable to a Single subscribing on the given Scheduler

async
Link copied to clipboard
open fun <R> async(block: (T, Consumer<R>) -> Disposable): Observable<R>

Returns an observable that will emit values in a possibly asynchronous manner determined by the given block.

callback
Link copied to clipboard
open fun <R> callback(block: BiConsumer<T, Consumer<R>>): Observable<R>

Returns an observable that will emit values in a possibly asynchronous manner determined by the given block.

combine
Link copied to clipboard
open fun <T2, R> combine(other: Observable<T2>, combiner: (T, T2) -> R): Observable<R>

Returns an observable that combines the emissions of this observable the given other. The downstream emission is the result of applying the combiner function to the latest emissions of both observables - and are only possible once both this and the other have emitted at least one value.

open fun <T2, T3, R> combine(other1: Observable<T2>, other2: Observable<T3>, combiner: (T, T2, T3) -> R): Observable<R>

Returns an observable that combines the emissions of this observable the given others. The downstream emission is the result of applying the combiner function to the latest emissions of both observables - and are only possible once all others have emitted at least one value.

distinct
Link copied to clipboard
open fun distinct(): Observable<T>

Returns an observable that only emits downstream when the newest emissions is not equal to the previous emission. Emissions will be compared using standard Objects.equals

open fun distinct(isEquals: (T, T) -> Boolean): Observable<T>

Returns an observable that only emits downstream when the newest emissions is not equal to the previous emission. Emissions will be compared using the provided isEquals function

filter
Link copied to clipboard
open fun filter(predicate: (T) -> Boolean): Observable<T>

Returns an observable that filters out emissions that do not match the given predicate

filterNotNull
Link copied to clipboard
fun <T> Observable<T?>.filterNotNull(): Observable<T>

Convenience method for converting an observable of nullable items, into an observable of non-nullable items.

flatMap
Link copied to clipboard
open fun <R> flatMap(transform: (T) -> Observable<R>): Observable<R>

Returns an observable that applies the given transform to the source emissions to produce new observables - all emissions from the resulting observables will be emitted downstream.

flatMapLatest
Link copied to clipboard
open fun <R> flatMapLatest(transform: (T) -> Observable<R>): Observable<R>

Returns an observable that applies the given transform to the source emissions to produce a new observable - only emissions from the latest observable created by the transform will be emitted downstream.

forEach
Link copied to clipboard
open fun forEach(block: (T) -> Unit): Observable<T>

Returns an observable that will call the given block with each source emission, before passing the original emission downstream.

map
Link copied to clipboard
open fun <R> map(transform: (T) -> R): Observable<R>

Returns an observable that applies the given transform to each emission before passing it downstream.

mapNotNull
Link copied to clipboard
open fun <R> mapNotNull(transform: (T) -> R?): Observable<R>

Returns an observable that applies the given transform to each emission before passing it downstream. Only emissions that are non-null after the application of the transform will be emitted downstream.

mapToUnit
Link copied to clipboard
fun <T> Observable<T>.mapToUnit(): Observable<Unit>

Convenience method that maps any incoming emission to Unit

merge
Link copied to clipboard
open fun merge(other: Observable<T>): Observable<T>

Returns an observable that will propagate all source emissions downstream from this observable and from the given other.

observeOn
Link copied to clipboard
open fun observeOn(scheduler: Scheduler): Observable<T>

Ensures that downstream observers receive events on the provided scheduler.

resubscribingWhile
Link copied to clipboard
open fun resubscribingWhile(predicate: (T) -> Boolean): Observable<T>

Returns an observable that will continually resubscribe until the predicate returns false.

startWith
Link copied to clipboard
open fun startWith(vararg item: T): Observable<T>

Returns an observable that will emit all the given item values before making a subscription to the source observable.

subscribe
Link copied to clipboard
open fun subscribe(onNext: Consumer<T>): Disposable

Subscribes the given onNext to receive updates, where no Observer.onComplete is required.

abstract fun subscribe(observer: Observer<T>): Disposable

Subscribes the given observer to receive updates, including an Observer.onComplete notification when the upstream source terminates.

open fun subscribe(onNext: Consumer<T>, onComplete: Runnable): Disposable

Subscribes the given onNext to receive updates, and the given onComplete to receive the Observer.onComplete signal

subscribe
Link copied to clipboard
fun <T> Observable<T>.subscribe(composite: CompositeDisposable, onNext: Consumer<T>): Disposable

Subscribes the given onNext to receive updates. The subscription is stored in the given composite

fun <T> Observable<T>.subscribe(composite: CompositeDisposable, observer: Observer<T>): Disposable

Subscribes the given observer to receive updates, including an Observer.onComplete notification when the upstream source terminates. The subscription is stored in the given composite

fun <T> Observable<T>.subscribe(composite: CompositeDisposable, onNext: Consumer<T>, onComplete: Runnable): Disposable

Subscribes the given onNext to receive updates and the given onComplete to receive the Observer.onComplete signal. The subscription is stored in the given composite

subscribeOn
Link copied to clipboard
open fun subscribeOn(scheduler: Scheduler): Observable<T>

Ensures that the subscription to the source observable happens on the provided scheduler.

subscribeOnce
Link copied to clipboard
open fun subscribeOnce(onNext: Consumer<T>): Disposable

Subscribes the given onNext to a single emission of the source.

open fun subscribeOnce(observer: Observer<T>): Disposable

Subscribes the given observer to a single emission of the source.

take
Link copied to clipboard
open fun take(count: Int): Observable<T>

Returns an observable that emits only the specified number of events given by the provided count

takeWhile
Link copied to clipboard
open fun takeWhile(predicate: (T) -> Boolean): Observable<T>
open fun takeWhile(inclusive: Boolean, predicate: (T) -> Boolean): Observable<T>

Returns an observable that emits downstream up until the predicate returns false.

Generated by Dokka
(c) Tealium 2026