This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-22
Channels
- # beginners (42)
- # boot (73)
- # cider (17)
- # clara (1)
- # cljs-dev (47)
- # cljsrn (9)
- # clojars (4)
- # clojure (241)
- # clojure-italy (11)
- # clojure-norway (5)
- # clojure-russia (93)
- # clojure-spec (28)
- # clojure-uk (32)
- # clojurescript (170)
- # core-async (20)
- # cursive (62)
- # data-science (2)
- # datomic (47)
- # dirac (4)
- # events (1)
- # funcool (12)
- # gsoc (1)
- # hoplon (59)
- # immutant (8)
- # lambdaisland (4)
- # luminus (3)
- # lumo (11)
- # off-topic (13)
- # om (81)
- # onyx (1)
- # pedestal (47)
- # planck (30)
- # re-frame (2)
- # reactive (1)
- # reagent (2)
- # ring-swagger (15)
- # rum (1)
- # slack-help (5)
- # specter (5)
- # testing (5)
- # uncomplicate (8)
- # untangled (16)
- # vim (71)
- # yada (16)
Hi! How do I configure jetty's maxidleconnections
in a service? Right now I'm doing:
(def service {:env :prod
;; You can bring your own non-default interceptors. Make
;; sure you include routing and set it up right for
;; dev-mode. If you do, many other keys for configuring
;; default interceptors will be ignored.
;; :http/interceptors []
::http/routes routes
;; Root for resource interceptor that is available by default.
::http/resource-path "/public"
;; Either :jetty or :tomcat (see comments in project.clj
;; to enable Tomcat)
::http/type :jetty
::http/port 8080})
Interesting, I tried lein clean
plus deleting io.pedestal and org.clojure from my .m2 directory, and now I’m getting No matching ctor found for class io.pedestal.interceptor.helpers$on_request$fn__8950
, which I’m not using anywhere in my project.
I think my next attempt is going to be lein new
plus incrementally copy over source files from my previous attempt.
@manutter51 Are you using any additional libraries that might have been built against an older version of Pedestal? Try adding :pedantic? :abort
to your project.clj to see if that's an issue.
I'm trying to write some Vase routes, but I can't find a full manual or reference. (I've been copying from the examples, and mostly understand what's going on, but not completely). I've looked at info about Vase, Datamic, and Datalog, and keep finding more pieces, but I can't find a doc that gives me the full picture; especially not from a Vase perspective.
Where should I look?
Ideally, I'd like a doc where I can find answers to questions like:
- How do I create a :get route that takes optional parameters? With this, how could I write a query that will find a user if I ask either api/user?name=joe
or api/user?id=42
?
- What exactly is :in $ ...
- When is it needed to give an entity an explicit id property? I would imagine this is seldom needed, yet it seems to be supplied in each of the Vase samples, so I'm missing some fact here.
- Etc.?
@mtnygard Ok, I added :pedantic? :abort
, but same results. Here’s my dependencies, as given by lein deps :tree
Hmm, Slack is saying the snippet was truncated, but it’s all there. As far as I can tell there are no pedestal dependencies except the ones I get via pedestal-service and pedestal-jetty.
Anyway, just for a sanity check, I did a lein new pedestal-service pedestal-test
, and that runs just fine. So I guess I’ll just copy over stuff until the new project also breaks.
@bradford I don’t have an answer for you but I’d recommend posting it to the pedestal-users group as well.
@bradford Here's the answer I got from Paul deGrandis:
There is an option within :container-options called :configurator
it's a function that takes and returns the Jetty Server argument
it's the ultimate escape hatch to do whatever you want to the server *as the very last step in setting up the server*
https://github.com/pedestal/pedestal/blob/master/jetty/src/io/pedestal/http/jetty.clj#L196
If it's not passed in, Pedestal sets the function to identity
@deg, thanks for the document suggestions. I was just wondering, though, were you able to find answers to those questions?
@ddeaguiar. Today's questions? No, not really. I did find some docs, mostly on the Datomic site, and now at least understand the syntax of the :in
clause. But. my other questions still have me stumped, and are more at the Vase level.
Ok, re: parameters, have you seen the Handling Parameters section in the Your First API doc? (https://github.com/cognitect-labs/vase/blob/master/docs/your_first_api.md#handling-parameters)
Yup, I have read that. Am I missing something? It looks to me like all the parameters are reduced to positional and mandatory by the time they get to the query.
re: explicit entity ids, I suspect this has to do with Datomic best practices (http://docs.datomic.com/best-practices.html#unique-ids-for-external-keys)
Re ids, that's what I figured, finally. So, best practice would be not to specify an explicit id unless I need it for some external purpose?
This makes complete sense, but is not the first impression that I got from the Vase samples.
So setting aside Vase for the moment, If you solely rely on the internal :db/id as an external identifier, it makes data migration more difficult
I need to think about what this means in terms of a Vase-enabled app, but IMHO it’s really not a Datomic-specific issue either. It’s a good recommendation for any backend store that generates identifiers
I'll need to think about that, in the context of my current toy application. But, assuming that I do want an external id on my entities, does Vase (or Datomic?) give an easy way to generate unique ids atomically?
you can generate unique ids that are Datomic index-friendly using (datomic.api/squuid)
(http://docs.datomic.com/clojure/index.html#datomic.api/squuid)
Yup, I've seen that Datomic section, but have not fully grokked it yet. So, how would I use squuid
in the context of a #vase/transact
?
I think my questions really keep boiling down to "I'm trying to understand how to do things right, but I'm only learning from samples, rather than formal docs that don't yet exist"
so to assign your own unique id, you’d need to pass it as part of your entity data in vase transact but
I need to go back and dig into Vase more deeply. My understanding of the internals is fuzzy so I’ll stop there before I inadvertently lead you astray.
Yes, Vase does seem to append the :db/id. But the samples, e.g. https://github.com/cognitect-labs/vase/blob/master/samples/pet-store/resources/petstore-simple.edn, do also have a domain-specific identifier in the schema, but seem to assume that it somehow magically comes from the client, even on creation.
I don’t think there’s a way to specify an attribute that get’s associated a value automatically upon transaction
my instinct tells me that, if anything, that’s would be done by an interceptor sitting in front of the transact action
For the client to do it, would require some kind of guid, not just e.g. a simple counter maintained on the server. (But, as I write this, I'm thinking that I'm being naive, and not addressing scalability. So, maybe I'm just blowing smoke here).
Again, thanks for the great feedback. I realize that the docs are failing you atm. We’re looking to fix that
Any thoughts on my other question (how could I write a query that will find a user if I ask either api/user?name=joe
or api/user?id=42
)?
Thanks. I'm happy to keep helping with the docs, but my knowledge is still limited. I've made a few small PRs, but am afraid to document too much when I'm just guessing.
Regarding your query question, I don’t know off hand but I’d guess it’s doable using an or
query predicate. I’d have to try it
To clarify, include both params in the :params
collection, and use an or
in the :query