reactivex - Many observer connected to one observable receive events one at a time -


this how create observable:

observable.fromcallable(new eventobtainer()).flatmap(observable::from).subscribeon(schedulers.io()).repeat(); 

and after that, through http request i'm trying add different observers. thing if have more 1 observer can't predict observer obtain emitted item. why doesn't observable emit item every subscribed observer, 1 item @ time different observers?

i resolved this,

in observable contract: http://reactivex.io/documentation/contract.html there information:

there no general guarantee 2 observers of same observable see same sequence of items.

so resolved making observable connectable observable publish, , invoke connect method on it:

observable.fromcallable(new eventobtainer()).flatmap(observable::from).subscribeon(schedulers.io()).repeat().publish(); observable.connect(); 

and if asynchronously add more observers emit obtained item every observers.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -