This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-19
Channels
- # aleph (8)
- # announcements (43)
- # babashka (43)
- # beginners (62)
- # calva (8)
- # cider (27)
- # clj-kondo (18)
- # cljs-dev (25)
- # cljsrn (16)
- # clojure (51)
- # clojure-europe (6)
- # clojure-nl (14)
- # clojure-spec (7)
- # clojure-uk (39)
- # clojurescript (17)
- # cursive (9)
- # datascript (12)
- # datomic (16)
- # events (1)
- # fulcro (7)
- # funcool (1)
- # graalvm (2)
- # graphql (5)
- # jobs (1)
- # juxt (6)
- # kaocha (9)
- # leiningen (11)
- # luminus (1)
- # malli (1)
- # off-topic (80)
- # other-languages (2)
- # overtone (3)
- # pedestal (5)
- # quil (1)
- # re-frame (6)
- # reagent (1)
- # reitit (4)
- # rewrite-clj (5)
- # shadow-cljs (207)
- # spacemacs (1)
- # specter (4)
- # sql (1)
- # vim (14)
- # xtdb (7)
Following up with the async and sync discussion. I still couldn't figure this out so maybe a good soul in the community would post something about it. I'm sure this isn't the first time this issue is bring to the light. I created a repository with the problem scenario: I'm back working in the issue and I created a repository with the scenario.. https://github.com/wcalderipe/lab-compojure-aleph-sync-and-async/blob/master/src/lab_compojure_aleph_async/core.clj
@wcalderipe you app should either be fully (sync) ring or async-ring (3 arity). In your example, line41, you define it as sync (1 arity). I don't think you can mix them in ring. Interceptor-model allows you to do it.
Thanks for taking a look on it 🙌 basically this is my original questions "can sync and async handlers coexist in ring?" and you might have answered it. Also, after you mentioned the interceptor model, I quickly found a good article about it, thanks! https://lispcast.com/a-model-of-interceptors/
an easy comparison: • with middleware: https://github.com/metosin/reitit/blob/master/examples/ring-swagger/src/example/server.clj • with interceptors: https://github.com/metosin/reitit/blob/master/examples/http-swagger/src/example/server.clj … the latter has one route returning a async value, a Manifold Deferred. All others all sync.
Thanks for sharing it!
More interceptor docs: http://pedestal.io/reference/interceptors Although it was really this Cognicast podcast that first introduced me to the reasoning behind Pedestal's interceptors and how they can be useful in modeling flow (outside of HTTP): http://blog.cognitect.com/cognicast-transcripts/118
I never really used Pedestal for anything, but I sure am happy that Paul deGrandis introduced me to the interceptor pattern. And it's nice that with things like metosin/sieppari
I can use them without importing pedestal
.
Thanks for sharing @U05476190 I'll definitely listen to it today