-1

Is there a way to create kafka consumers in a clojurescript app that I am trying to create. My kafka cluster is at AWS MSK which is configured to use SASL_SSL/IAM auths. And my client-side application is build on clojurescript. I tried to search for working third-party Libraries but couldn't find anything for clojurescript. Does anyone know any other way to create consumers in cljs.

I tried few clojure libraries like clj-kafka, kafkaesque, devoplt/kafka, etc but nothing works.

  • I'd look for a JS library and use it from CLJS via interop. – Eugene Pakhomov May 11 '23 at 09:48
  • 1
    "but nothing works" gives us nothing to work with. Please add the code you have tried and how it failed (e.g. errors, stacktraces, logs, ...) so we can improve on it. – cfrick May 11 '23 at 12:03
  • 1
    Define "client-side application". Are you trying to consume Kafka messages from a browser, or...? – Dave Newton May 11 '23 at 14:52
  • @EugenePakhomov, can you point me to some example to to use a JS library in CLJS via interop? I am using boot build tool for my cljs code and the code is then later compiled into javascript and it is being used as a script on my client-side application which runs on browser. – ctrl_dev May 12 '23 at 12:17
  • @DaveNewton pls look at above comment^ – ctrl_dev May 12 '23 at 12:18
  • JS interop is covered in the CLJS docs and most CLJS tutorials. – Dave Newton May 12 '23 at 12:31

2 Answers2

0

You cannot use Clojure clients since they'll likely either be using a Java Client implementation or interface directly via Java IO systems. These do not exist in Clojurescript and are therefore incomptaible.

You want to be looking for JS Clients instead and use those. I have my doubts that it is a good idea to talk directly to Kafka from a client side, but I have never used it so I don't know if thats even an option.

The most common setup likely is for people to talk to Kafka from their servers and then provide their own API for the frontend. I'm sure you can write such a server in ClojureScript using a JS API client, but I cannot point you to anything specific.

Thomas Heller
  • 3,842
  • 1
  • 9
  • 9
0

Kafka isn't a frontend, technology. Most GUI's for Kafka assume direct connectivity, and are not using AJAX... It's that what you want, regardless of client library, use an HTTP Proxy like Confluent's Kafka REST Proxy

Then, all you need is an HTTP client, not a Kafka specific one

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245