Has anyone used Clojure yet for Lambda durable functions?
@software.adhoc.87 could you provide a toy example? I'm really struggling to get the DurableHandler class extended within Clojure. Did you use another approach?
yes i ddi
Direct interop with the Java SDK? How'd you like it? I'm thinking of ditching Step Functions and all of the extra Terraform and ASL
I used direct interop with the Java SDK. Honestly worked better than I expected Clojure sits pretty naturally on top of it once you wrap a few rough edges. The big win for me was simplifying orchestration logic and avoiding the Step Functions + ASL + Terraform sprawl You still need to think carefully about determinism/replay behavior, but after that it felt pretty ergonomic
Does aws-api have any request timeout by default? Looking through the relevant code and discussions, it seems like cognitect.http supports request timeouts but aws-api doesn't set request timeouts, and there's no way to set request timeouts without providing a custom http client. Is that correct?
Hmm, interesting. But that can leave the client/socket hang indefinitely, can't it?
@jumar Thanks! The approach I settled on btw is to just handle this in userspace - deref a future w/ a timeout or in core.async world use a timeout channel.
At least when I needed it I ended up creating a custom http client. https://github.com/cognitect-labs/aws-api/issues/41 This is what it looks like at the moment
(defn- create-http-client
"Creates an http client to be used by aws api instead of their default/shared http client.
The main reason for this is to be able to customize timeouts - see also .
Previously we used an instance of `cognitect.http-client` but that uses old jetty-client version which has a CVE (and unnecessary dependencies).
The new way is to use a pure java implementation as in `cognitect.aws.http.java`.
Instead of directly calling `cognitect.aws.http.java/create` we make a copy of that function
to be able to customize 'connect timeout' and not only 'socket timeout')
"
[{:keys [conn-timeout request-timeout] :as _options}]
;; Copy `cognitect.aws.http.java/http-client` and adjust the connection timeout
(let [client (-> (HttpClient/newBuilder)
(.connectTimeout (Duration/ofMillis conn-timeout))
(.followRedirects HttpClient$Redirect/NEVER)
(.build))]
(reify aws-http/HttpClient
(-submit [_ request channel]
(java-http-client/submit client
;; set custom socket timeout (see `cognitect.aws.http.java/request->java-net-http-request`)
(assoc request :timeout-msec request-timeout)
channel))
(-stop [_]
(java-http-client/stop client)))))