Question
· Mar 30, 2023

%External.Messaging and Kafka

I am trying to write a message to a Kafta cluster programmatically (i.e. not in Ensemble or using a Production) using %External.Messaging.  I am consistently getting a 'topic not found error' even though I have created the topic on the cluster.  I dug into the client I created an when accessing the property KaftaClient.jclient.gateway I get the following output:

<THROW>%DispatchGetProperty+25^%Net.Remote.Object.1 *%Net.Remote.Exception <GATEWAY> com.intersystems.gateway.GatewayException com.intersystems.gateway.JavaGateway.dynamicExecuteGet(JavaGateway.java:3761) Field not found: com.intersystems.messaging.KafkaClient.gateway

I did check and reset my JAVA_HOME env variable thinking this way the problem, and after restarting the server I still get this error.  I can't seem to edit the External Language Servers in the management portal (I run a local instance of IRIS and have all roles), however I may be confusing a gateway with an external language server?  My JAVA_HOME is a is a JRE (C:\Program Files\Java\jre1.8.0_361) not a JDK if that matters?

I'm aware that there may be a multitude of reasons why this isn't working but this stood out to me as something that could be a reason things aren't working. I read on a Stack Exchange article that people have the same issue using Spring Boot were missing some kind of Java-JSON dependency, so I thought to look for something Java related to solve my problem.  

I would sure appreciate some thoughts if anyone has some to spare!

Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2022.1.2 (Build 574U) Fri Jan 13 2023 15:00:26 EST
Discussion (4)1
Log in or sign up to continue

@Eduard Lebedyuk thanks for your response here!

I changed directions and used embedded Python and a library called kafka-python which appears to be well-used and supported.  Using this, I've had no issues getting connected to my server, plus now I have access to more commands for Kafka.  

Before I edit or setup a new External Language Server 1) do you think the %Net.Remote.Exception is related to the Java Home on the external language server not being setup and 2) if I had multiple external language servers setup, how would I tell %External.Messaging (and specifically the Kafka client) to use one or the other?

It would be ideal to stick with COS libraries and features, but I think the Python library is the best solution as it offers more in terms of an API, but I'd still like to get %External.Messaging working for other purposes.