Fork me on GitHub
#yada
<
2016-11-30
>
kurt-yagram11:11:56

@bbss :

(:require [aleph
             [http :as http]
             [netty :as netty]]
            [bidi.ring :as bidi]
            
  ... 

  (let [http-server (http/start-server
                     (bidi/make-handler api)
                     (::http config))]
    (netty/wait-for-close http-server)))

genRaiy13:11:23

am working on a synchronous event sourcing approach using yada …

genRaiy13:11:55

my initial approach is to have a method :response that publishes a command on an event server and then waits for the event signalling the resource creation

genRaiy13:11:26

I am using core.async as a strawman for the event system and it all works fine

genRaiy13:11:04

… but am wondering if it would be more idiomatic to tie the publish / look up resource events into the yada lifecycle

genRaiy13:11:52

I’ve gone back and forth over the docs and can’t determine simple places to hook in so maybe the first approach is more idiomatic 😉

malcolmsparks13:11:54

If you can get the first approach to work that would be better. Only because yada's interceptors are designed to work in a linear ordered sequence, which took a long time to refine. It's generally OK to add interceptors, but not much more than that

malcolmsparks13:11:02

yada 2.0 has a more 'monadic' design to the interceptor chain and it will be possible to add all kinds of user-provided instrumentation adaptors etc.

genRaiy13:11:22

ok, cool well it does all work now so I will leave it as is

malcolmsparks13:11:41

e.g. for dev, your interceptors get more instrumented and the context is captured (for inspection) between each interceptor

genRaiy13:11:58

I look forward to an depth discussion soon!

malcolmsparks13:11:26

there is also a concept of profiles, so you can run the yada resource in different profiles (e.g. for dev and prod), which helps to balance trade-offs between raw performance, security and debuggability.

genRaiy13:11:32

great stuff, thanks @malcolmsparks … once I got my head around the ctx I was good to go

stijn13:11:21

@malcolmsparks does that allow for metrics capturing like in Zach's talk about the pumpkin carvers? 🙂

malcolmsparks13:11:27

but yada 2.0 is some way off, and even when I release it it will be some time before it gets to the feature-list of 1.1.x

malcolmsparks13:11:45

I'll still be supporting 1.1.x for a long time yet

stijn13:11:00

i have a question on 1.1.x

stijn13:11:05

can I avoid this Cannot JSON encode object of class: class java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: No implementation of method: :charset of protocol: #'yada.charset/Charset found for class: java.lang.String?

stijn13:11:59

the problem with these is that the stacktrace of the original error is no longer available in the server log

stijn13:11:46

hmmm via :responses maybe?

genRaiy23:11:35

@stijn: did you answer the question?

nha23:11:52

Would it be possible to use something like this in yada https://github.com/yeller/clojure-miniprofiler ?

nha23:11:10

I guess I would have to make an interceptor - what would be a good starting point?