Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michael Nitschinger
    @daschl
    yes, but concat appens obs1 to obs2 when obs2 is done
    but your hot stream, is it finite or infinite?
    updates sounds infinite to me
    Javier Domingo Cansino
    @txomon
    cl is finite (one time) and cu is infinite
    so it would be to concat initialization + updates
    (initialization goes first)
    Michael Nitschinger
    @daschl
    ah well then did you try the concat operator?
    Javier Domingo Cansino
    @txomon
        return Observable.concat(
                contactRepository.getContactList().flatMap((a) -> Observable.from(a)),
                contactRepository.getContactUpdates()
        );
    that was what I had done
    Michael Nitschinger
    @daschl
    okay
    Javier Domingo Cansino
    @txomon
    the thing is that I don't have really clear where should I do the buffering
    Michael Nitschinger
    @daschl
    what do you mean with buffering? who should buffer what?
    Javier Domingo Cansino
    @txomon
    sorry, I am mixing stuff
    Michael Nitschinger
    @daschl
    :)
    Javier Domingo Cansino
    @txomon
    so contactRepository is the data layer
    now I want that the business layer (where this function is), merges all the items until someone subscribes
    Michael Nitschinger
    @daschl
    aah now I see where you are going
    Javier Domingo Cansino
    @txomon
    that would be using contact repository to create a hot observable with all the items
    Michael Nitschinger
    @daschl
    so first, even if one of the inner observables is hot, the outer one is cold so you’ll only see events if someone subscribes.. and what happens to the hot one below depends on the subject that you use
    Javier Domingo Cansino
    @txomon
    yeah, the concat needs something after it
    Michael Nitschinger
    @daschl
    keep in mind that hot observables, when wrapped, can become cold again (check Observable.defer for example)
    Javier Domingo Cansino
    @txomon
    sure
    Michael Nitschinger
    @daschl
    so you want to cache it basically?
    Javier Domingo Cansino
    @txomon
    I want to cache, deleting outdated items
    Michael Nitschinger
    @daschl
    there is a cache operator ;)
    Javier Domingo Cansino
    @txomon
    oh
    let me see..
    replay I think is the stuff you want
    and you can bound it so it throws away old stuff
    Javier Domingo Cansino
    @txomon
    but what I need to do is to create a cache that caches the latest items of every Contact id
    .cache() doesn't let me filter them
    Michael Nitschinger
    @daschl
    aaah now I get what you want :D
    Javier Domingo Cansino
    @txomon
    I would need to hold a list of contacts within my business logic that caches all the contacts, and updates them cached
    Michael Nitschinger
    @daschl
    you always want access to the latest contact informating including updates
    latest one for every contact
    Javier Domingo Cansino
    @txomon
    indeed, this is now the second layer
    Michael Nitschinger
    @daschl
    well, how many contacts do you have? because if you store aggregated list, this could get huuuge right?
    Javier Domingo Cansino
    @txomon
    I need to hold them anyway, so it doens't matter
    anyway, this is going to be a listview later in the app
    Michael Nitschinger
    @daschl
    well, there is a way to do it
    remember, there is always a way in rx :D
    Javier Domingo Cansino
    @txomon
    yeah
    I was thinking on distinct
    Michael Nitschinger
    @daschl
    so then before the cache() (which is your last operator then), you add
    Javier Domingo Cansino
    @txomon
    btw, I think the documentation is incomplete...
    Michael Nitschinger
    @daschl
    no, you want scan()
    Javier Domingo Cansino
    @txomon