This version (2017/05/27 13:44) is a draft.
Approvals: 0/1

[14:45:00] <monko> hey everyone! look what i built …

[14:45:20] <monko> my question is: is this a good idea, and why not?

[14:58:09] <Sticky> monko: ooi what is the motivation, what usecase would have multiple queries with all their results pumped into 1 handler?

[14:59:47] <Sticky> we do have cases of wanting to run multiple queries but generally want each queries results handled differently

[15:03:27] <monko> that's still possible

[15:04:07] <monko> the use case is to run independent queries concurrently instead of query B having to wait until query A is finished

[15:04:22] <monko> the handler is over a map with a string key, so you can identify the results

[15:06:03] <monko> the handler can gets called when all queries have finished and can retrieve the different results by the key (and process them independently)

[15:07:20] <Sticky> I havnt looked at the vertx-jdbc-client, but I am, fairly sure it should be able to do multiple queries concurrently

[15:08:04] <monko> yes, it does - but usually only from different requests

[15:10:00] <monko> i.e. query(A, resA → query(B, resB, final → dosomethingWithAandB(resA, resB)))

[15:10:48] <monko> this means that request B isn't started before A has finished, even though B doesn't depend on A

[15:11:04] <Sticky> so this is where I personally would use rx

[15:11:38] <monko> i'm a bit ashamed because i haven't looked into rx yet

[15:11:56] <Sticky> it does take a bit of getting used to

[15:12:02] <monko> guess that's exactly what rx is for

[15:12:31] <monko> well, i'll finish my little fun project the traditional way and then rewrite to use rx

[15:12:37] <monko> so i'll learn both waysw

[15:13:08] <monko> thanks for having a look at it, sticky

[15:28:12] <Sticky> monko: so the rx methods you may want to look at for combining mutiple observables are merge, concat, zip and And-Then-When

[15:28:42] <Sticky> but there is a whole load of docs for combining observables

[15:29:11] <monko> thank you

[15:29:44] <Sticky> if you dont want to bother going rx yet though, I dont think there was anything wrong with what you were doing

[15:32:17] <monko> well, it has the advantage of a) running the requests in parallel and b) reducing callback hell a bit

[15:32:57] <monko> but of course it's tailored to concurrent db requests, not a general purpose method