Fork me on GitHub

I am thinking about using lacinia for graphql support in an app that makes heavy use of core.async internally, all database operations run on a threadpool and return results over channels, etc. I am trying to figure out if that model works with lacinia. It looks like I define some kind of crud sort of functions for some types, and lacina uses a scheme to figure out how to execute those functions to satisfy a query. Is there some way to have those crud functions return a result channel instead of the actual result?


I'm building the same thing, and absolutely yes.


You might find that there's a better way to accomplish this, specific to your application, but it's largely trivial to convert a core.async channel into a ResolverResult.


Mostly it's a question of how to handle exceptions, and how to handle large results sets.


but in that case executing the query will really block a thread instead of doing the light weight park thing, so executing the query will need to be on a threadpool anyway


No that's not true. Lacinia is actually fully asynchronous internally (but doesn't use core.async). It's all based on callbacks (just like core.async under the covers). There's also support for controlling the threadpool used when invoking those callbacks.


ResolverResult is pretty much a Promise (in the JavaScript sense).


but it won't yield control of the thread that calls execute so that thread can do other things while waiting for some operation


It will if you pass the :async true option to lacinia-pedestal's service-map.


how would I do that without using lacinia-pedestal?


interesting, thanks


i made a small lucinia project in .17 and been on something else for a while. has a lot changed since then?


trying to follow the pedistal instructions and it seems to fail with resources\graphiql system cannot find the file specified any suggestions on what to do? the proj file has :shell {:dir "resources/graphicql"} in it.


What version are you building against? Have you checked out the release notes?


There's been some minor course corrections.


Straightening out the graphiql paths is the most troublesome stuff; if you were "coloring outside the lines" there, it'll likely hurt a bit.


I wasn't very far in my clojure implementation so i'm just starting over. I think i figured out that the lacinia-pedistal isn't a starter app it is a dep i need to pull in, still working on the start up yet though.


Have you seen the Lacinia tutorial? It gets you going with baby steps, and covers lacinia-pedestal as well.


ah, cool. i was on this one


That's the lacinia-pedestal manual, more of a reference.