Once JOOQ has a Java9 dependency that'd be great. In the meantime most of these libraries have convenicen APIs for this purpose. For instance to convert that stream into an RxJava observable is just Observable.from(jooqStream::iterator). It'd be nicer to say fetchIntoObservable but not much nicer :-)
- Mike Foody Providence HR http://www.providencehr.com (832) 714 1652 [email protected] On Thu, Mar 2, 2017 at 9:53 AM, Lukas Eder <[email protected]> wrote: > Yes, indeed, an Observer might be a better way to abstract over a stream > of data to merge into different target tables. > > It would certainly work with a Java 8 stream as well, but maybe this > feature request might just be a good enough reason to embrace what appears > to become a new de-facto standard SPI in the Java ecosystem: the > http://www.reactive-streams.org and/or JDK 9 Flow: > http://download.java.net/java/jdk9/docs/api/java/util/concurrent/Flow.html > > I'd rather not consider a direct dependency on RxJava, though. > > The relevant feature request is: > https://github.com/jOOQ/jOOQ/issues/4371 > > 2017-03-02 14:28 GMT+01:00 <[email protected]>: > >> Please excuse me if I misunstand the requirements. You want to process >> the stream of data and collect it into inserts into the contact history >> table and updates to the email address and then batch process these once >> you've collected enough to make the batch efficient. The pain is that Java >> streams aren't easily split and don't provide an API to deal with the >> window functionality. You might take a look at RxJava. You could create an >> RxJava observable from your stream of data with multiple subscribers. One >> subscriber would filter the stream looking for inserts, the other for >> updates. You could then use the built-in window functionality to collect >> inserts / updates until you have the number needed for efficiency. Here's a >> couple links that flesh this out. >> >> http://blog.danlew.net/2016/06/13/multicasting-in-rxjava/ >> http://stackoverflow.com/questions/25165520/rxjava-window-on >> -count-or-timespan-without-dropping-elements >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "jOOQ User Group" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/jooq-user/Yt5ZQOapNek/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
