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
    How offten do config values change?
    Javier Domingo Cansino
    @txomon
    @Dorus not really frequently, but I want to do everything reactive, because I might implement backends in the app, so config sources may vary and be changed anytime really
    so having the UI change the config value, would mean actually almost the same as the backend changing it
    Leander Kurscheidt
    @LeanderK
    is there a web framework, where the answer is decoupled from the request, so that i can have observable streams of the requests and zip some, map some and in the end answer them with the result
    Abhinav Solan
    @eyeced
    Hi all, I am trying this code
    Observable.just(1, 2, 3, 4, 5, 6)
    .groupBy(i -> i % 3)
    .flatMap(o -> o.first())
    .subscribe(System.out::println);
    Now this should have just got me (1, 2, 3) as the result but it is giving
    1
    2
    3
    4
    5
    6
    Dorus
    @Dorus
    Possibly, first() unsubscribes so groupBy recreate the group?
    Try .distinct(i -> i % 3) instead.
    Abhinav Solan
    @eyeced
    is that a bug ?
    Dorus
    @Dorus
    I'm not 100% sure. Let me test what Rx.Net does.
    yup, Rx.Net gives 1,2,3 as expected.
    I would suggest you fill a bug and see what the devs say about this. Seems fishy.
    Abhinav Solan
    @eyeced
    ok thanks
    Dorus
    @Dorus
    #3411
    Dorus
    @Dorus
    I've read up on it a bit, ther's something to say for both implementations. The Rx.Net variant is the one you would expect, but the RxJava has some uses too. Mainly not leaking resources.
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin
    @LeanderK hadn't seen any Web frameworks with RxJava in the core, but there are a lot with non blocking io so you can pretty easily integrate them with RxJava
    Leander Kurscheidt
    @LeanderK
    any recommendations?
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin
    @LeanderK well, I don't want to give any particular recommendations because it should be your own choice, personally, I prefer little bit more low level things like Netty (and there is RxNetty). Please just google web frameworks with non-blocking io and try some of them :)
    Javier Domingo Cansino
    @txomon
    hmmm thinking about how to make a reactive repository pattern, I had thought about having the repo send a Observable<List<Item>>, and sending an Observable<Item> that would send the updates for each item
    of course, in my business logic, I would need to convert the Observable<List<Item>> into a stream of Observable<Item>, and concat the updates from Observable<Item>
    but I have no idea on how to do it :(
    Michael Nitschinger
    @daschl
    @txomon can you explain a little more?
    happy to help :)
    Javier Domingo Cansino
    @txomon
    @daschl so I have a set of items that can be updated
    Michael Nitschinger
    @daschl
    okay, can you show me some simple API or so?
    Javier Domingo Cansino
    @txomon
    the design I have come up with would be
    sure
    public interface ContactRepository {
        Observable<List<Contact>> getContactList();
    
        Observable<Contact> getContactUpdates();
    }
    Michael Nitschinger
    @daschl
    okay
    so let me ask something
    Javier Domingo Cansino
    @txomon
    (I have deleted the other call which isn't interesting for the usecase)
    Michael Nitschinger
    @daschl
    okay gotcha I think, so whats the problem from there?
    Javier Domingo Cansino
    @txomon
    just in case, this is an app I am building to train myself in rx, android etc. so the idea is, the Observable<List<Contact>> getContactList() returns a cold observable and the Observable<Contact> getContactUpdates() returns a Hot observable
    Michael Nitschinger
    @daschl
    ah okay, so you mean that every time an update comes in a new contact is pushed?
    Javier Domingo Cansino
    @txomon
    yep
    Michael Nitschinger
    @daschl
    alright
    Javier Domingo Cansino
    @txomon
    the user of the interface is prepared to update contacts by having new objects sent directly
    Michael Nitschinger
    @daschl
    okay, and where is the trouble for you implementing?
    Javier Domingo Cansino
    @txomon
    so, the idea is to create a cold Observable<Contact> that, concatenates the return getContactList(), which has to be converted into Observable<Contact> items, and the buffered getContactUpdates return
    lets call cl to the return of getContactList(), cu to the return of getContactUpdates
    Michael Nitschinger
    @daschl
    so you want, every time Contact is emitted on the hot observable, “merge” it with the data on the cold one?
    Javier Domingo Cansino
    @txomon
    nope
    not here
    that is made by the user, now I need to generate a single stream of updates
    Michael Nitschinger
    @daschl
    okay, so you want to know how to create a hot observable?
    Javier Domingo Cansino
    @txomon
    the idea is to convert cl into an Observable<Contact> that emits all the items in cl
    Michael Nitschinger
    @daschl
    aah gotcha
    Javier Domingo Cansino
    @txomon
    then concatenate that to the output of cu
    this is the interface provided by the repository, meaning that I have an initial fetch, and updates to that initial fetch
    Michael Nitschinger
    @daschl
    So you wantfrom N List<Contact> to N * list.size() emits in the first step