dependabot[bot] on github_actions
dependabot[bot] on github_actions
Bump actions/setup-go from 2 to⦠(compare)
dependabot[bot] on github_actions
observer.onNext
, wait for its completion then call the second observer.onNext
obs := Just(1, 2, 3).Publish()
got1 := make([]interface{}, 0)
obs.Subscribe(handlers.NextFunc(func(i interface{}) {
got1 = append(got1, i)
time.Sleep(200 * time.Millisecond) // Pause the observer on purpose
}), options.WithDropBackpressureStrategy())
obs.Connect()
time.Sleep(500 * time.Millisecond) // Ugly wait just for the example
fmt.Printf("%v\n", got1)
=> Display 1
obs := Just(1, 2, 3).Publish()
got1 := make([]interface{}, 0)
obs.Subscribe(handlers.NextFunc(func(i interface{}) {
got1 = append(got1, i)
time.Sleep(200 * time.Millisecond) // Pause the observer on purpose
}), options.WithBufferBackpressureStrategy(3))
obs.Connect()
time.Sleep(500 * time.Millisecond) // Ugly wait just for the example
fmt.Printf("%v\n", got1)
=> Display 1, 2, 3
hot_observable
)
time.Sleep(200 * time.Millisecond)
so it's just able to consume 1
They introduced specialized observable - Flowable. Thanks to flowable introduction, the back pressure is applied properly through whole pipe.
What do we have exactly in RxJava? Observable
for cold observables, Flowable
for hot observable with back-pressure and ConnectableObservable
for hot observables without backpressure starting to publish once connect()
is called?