Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dorus
    @Dorus
    @spockz That sounds like the scenario where you use .publish().refCount()
    Observable.using still creates a new resource every time you subscribe. But .publish().refCount() will make you multicast.
    Alessandro Vermeulen
    @spockz
    would that be Observable.using(...).publish().refCount() then?
    Dorus
    @Dorus
    You still need to think about what you want to push onto your subscribers. If it's only live data, publish would work. If they also need to get the most recent element on subscription you could use replay(1) etc.
    Alessandro Vermeulen
    @spockz
    @Dorus only live data is necessary
    Dorus
    @Dorus
    using is only used to tie the lifetime of the resource to the subscription.
    Shouldn't it be Observable.using(() -> dir.register(watcher), ....?
    There are other ways to solve it, but using would certainly be valid.
    Alessandro Vermeulen
    @spockz
    So I can change it to as follows:
    val watcher: java.nio.file.WatchService
    var outputStreams: Map[WatchKey, Subject[WatchEvent[Path]] = Map.empty
    var queries: Map[Path, Observable[WatchEvent[Path]] = Map.empty
    
    def watch(dir: Path) =
       // if dir is contained in queries return it, otherwise create it by using watch2 and add it to queries
    
    def watch2(dir: Path): Observable[WatchEvent[Path]] = 
        Observable.using(dir.register(watcher), key => createObservable(dir, key), key => key.cancel()).publish().refCount()
    
    def createObservable(dir:Path, watchKey: WatchKey): Observable[WatchEvent[Path]] = {
         // return create publish subject and add it to outputStreams
         // we assume that publish() and refCount() will take of having only 1 direct subscriber
    }
    @Dorus and yes, in Java, but in RxScala the using method is defined with a call by name argument for the resource factory.
    Dorus
    @Dorus
    ooh cool. I'm not that familiar with Scala :)
    Alessandro Vermeulen
    @spockz
    @Dorus its a nice feature which enables 'laziness' transparently :)
    @Dorus there is also share():
     public final Observable<T> share() {
            return publish().refCount();
        }
    Dorus
    @Dorus
    yeah i know. Forgot if that was a RxJava thing ^_^
    Alessandro Vermeulen
    @spockz
    @Dorus how do you use RxJava ?
    Dorus
    @Dorus
    not really
    Using Rx.Net mostly, and even that not much right now. Mostly hanging out in these gitter channels to help people out :)
    RxJS is the most active, so i'm getting more familiar with that now.
    Alessandro Vermeulen
    @spockz
    @Dorus amazing! it is much appreciated. :)
    @Dorus is there a different channel for all of the dialects?
    Dorus
    @Dorus
    yeah
    I'm not sure why RxJava is not connected to the rest.
    Alessandro Vermeulen
    @spockz
    different repos?
    in different orgs
    ReactiveJS is pretty busy with almost 1k participant
    Dorus
    @Dorus
    ReactiveJS has nothing to do with Rx right?
    Alessandro Vermeulen
    @spockz
    @Dorus sorry meant RxJS :)
    Dorus
    @Dorus
    yeah, very active.
    Alessandro Vermeulen
    @spockz
    I could imagine that React and Angular would use RxJS for their streaming purposes instead of their own stuff..
    David Stemmer
    @weefbellington
    @Dorus are you an Rx contributor?
    Dorus
    @Dorus
    ?
    David Stemmer
    @weefbellington
    I mean do you contribute to one of the frameworks itself
    Dorus
    @Dorus
    code? Not really, i did fill some bugs
    David Stemmer
    @weefbellington
    I was just curious, I know Artem Zinnatullin works on RxJava, just thought you might be a contributor since you're the most active in this channel
    Dorus
    @Dorus
    I haven't seen many contributors yes in these channels, they usually do respond quickly to github issues.
    David Stemmer
    @weefbellington
    unfortunately, it seems like the number of rxjava contributors has dwindled over time
    Dorus
    @Dorus
    @weefbellington I've seen your name around a few times before, what's your tie to Rx?
    David Stemmer
    @weefbellington
    no tie just a user
    but I think that Ben Christensen is pouring his efforts into Reactive Extensions right now
    Reactive Streams I mean
    I believe that David Karnok is the core contributor now but he spends a lot of his time on nowadays on Project Reactor rather than RxJava
    Dorus
    @Dorus
    ic. I did notice Rx development is kinda slow. Good thing the current library is pretty solid.
    RxJS does seem to have a lot of progress on v5.
    And Rx.Net is completely silent.
    David Stemmer
    @weefbellington
    do you know if v5 using the Reactive Streams specification?
    Dorus
    @Dorus
    All i know is that the migration document mentiones "Compliance with the ES7 Observable Spec"
    (And also that i like onNext a lot more than next)
    Alessandro Vermeulen
    @spockz
    @Dorus do you know about any comprehensive documentation regarding back pressure? Akka streams have it automatically, how about rxjava?