Hello,
I am working on a simple project to transmit simulated device data generated by Ignition (on Docker) to a Kafka broker that I have running locally. I am trying to leverage the Ignition Kafka Community Module repo to do this.
I have 2 questions on trying to get this module setup so far:
1. Has anyone been able to use this module successfully so far in this manner, and if so, could you share some thoughts on next steps to troubleshoot the 404 error below?
So far, these are the steps I have taken:
- built the module using
mvn package
and signed it to generate a signed.modl
file - added the
.modl
file to a running instance of Ignition Gateway (running on Docker) - I now see the module added to the gateway and running successfully
- I set up a kafka producer and consumer using Confluent Platform commands like so:
➜ bin ./kafka-console-producer --topic ignition-consumer-test --bootstrap-server localhost:9092
➜ bin ./kafka-console-consumer --topic ignition-consumer-test --bootstrap-server localhost:9092
-
I am able to see msgs flow from the producer to consumer following these commands
-
I then opened a Script Console on Designer Launcher to run the Consumer snippet found in the repo README. To keep things simple, I started by using the non SSL
getConsumer
method as seen below:
serverPath = 'server:9093'
# consumer = system.kafka.getSSLConsumer(serverPath,'topicname','groupname') # if SSL is desired
consumer = system.kafka.getConsumer(serverPath,'topicname','groupname') # If ssl is not required
for record in consumer:
print record["value"], record["timestamp"],record["offset"],record["key"],record["partition"]
- Some other notes: I have also tried a few different serverPath values:
host.docker.internal:9092
andserver:9092
. I also tried port9093
for these as specified in the above snippet.
The resulting stack trace raises a 404 error as follows:
Java Traceback:
Traceback (most recent call last):
File "<input>", line 2, in <module>
at com.sun.proxy.$Proxy61.RPCGetConsumer(Unknown Source)
at org.ignitionmdc.apache.kafka.Kafka_Com.getConsumer(Kafka_Com.java:13)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.reflect.UndeclaredThrowableException: java.lang.reflect.UndeclaredThrowableException
at org.python.core.Py.JavaError(Py.java:552)
at org.python.core.Py.JavaError(Py.java:543)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
at org.python.core.PyObject.__call__(PyObject.java:515)
at org.python.core.PyObject.__call__(PyObject.java:519)
at org.python.pycode._pyx122.f$0(<input>:3)
at org.python.pycode._pyx122.call_function(<input>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.core.Py.exec(Py.java:1658)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)
at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy61.RPCGetConsumer(Unknown Source)
at org.ignitionmdc.apache.kafka.Kafka_Com.getConsumer(Kafka_Com.java:13)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
... 19 more
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Post Error, error code = 404
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:347)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:468)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:283)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:908)
at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
... 26 more
2. Has anyone tried to extend this module to produce messages and transmit over through the Kafka broker for downstream consumption? The repo README claims this is relatively simple, but I’m not sure how to get started with this step. If so, could you share thoughts on this as well?
Thank you for your time!