-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
Jetty
Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
I was expecting something that (for example) spawned a future to run handler within and used the response of that future to write the servlet response, but from https://github.com/ring-clojure/ring/blob/1.6/ring-jetty-adapter/src/ring/adapter/jetty.clj#L29-L41 it looks like any work we do in handler to get the data and build the response-map will just block the servlet thread.
Designating a single thread to act as a consumer would work, but it's probably easier to use a library like ketu, which is an async Clojure client for Kafka.
I've now got this working, sort of, so thank you for that! The sort of is because I'm getting the response I expected, but I'm also getting an exception from Jetty for every request. I've followed your pattern as given above, and when I curl the server I get the expected data back. But the REPL I'm running it in for local dev also gives the error Exception in thread "async-dispatch-[0-9]+" org.eclipse.jetty.http.BadMessageException: 500: No version. Googling that leads me to https://github.com/eclipse/jetty.project/issues/650, which seems to suggest that something else is attempting to handle the message a second time, while my handler is parked for a response in the go block? If I wrap the (a/go ...) in (a/, to effectively force it to be synchronous again, the error goes away.