I’m using the HiveMQ library in my Java Spring application to connect to a Mosquitto instance as I find it more user-friendly compared to the Paho client. But something is going wrong with the automatic reconnection. From time to time the connection is lost and the application doesn’t succeed in r…
Tag: mqtt
Direct Buffer Memory error when connecting mqtt
we are running an Apache Beam Apllication on a Flink Cluster. Since a few days the application fails with the following error: The connection is build up with the following method: But it runs on my machine When I start the application from my eclipse project all works fine. So the error only happen in the Fl…
How can i connect a Java mqtt client with username and password paho client
This code works in Android Studio but how can i log in with username and password? Can somebody help me please. Answer You need to use the version of client.connect(); where you pass a MqttConnectOptions object See the docs here
Java Paho MQTT client connection over reverse proxy
I’m using the Java paho library to communicate to an mqtt broker. Using the code below I’m able to connect fine. However, I have the mqtt broker behind a reverse proxy, so I don’t need to open up a separate port. So what I need to do is instead of connecting to “tcp://192.168.1.100:188…
Multi MQTT clients subscribed to the same topic
I have actually a spring boot application with a MQTT client into it that is subscribed to topic. I encounter a problem when i put 2 instances of my application ( 2 containers/pods ) because it creates 2 connections to the publisher ! The problem is that I record things in a database for each message, so I re…
MQTT and SpringBoot Integration Connection Lost
I currently have an API in SpringBoot and I would like to add an MQTT client to subscribe to one or more topics. I tried several Paho,Hive clients, without success, I’m currently on the default MQTT of SpringBoot which uses Paho but I can’t get it to work even with the basic configuration. I get a…
How to fix “javax.net.ssl.SSLHandshakeException: TLS Server certificate issued after 2019-04-16 and anchored by a distrusted legacy Symantec root CA”
I got the exception below while connecting to a MQTT Server with Java and self signed certificates. I used VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem as cacert.pem. The code is for an Linux server but currently I’m programming it on IntelliJ IDEA. The output is: I tried to connect to…
How to prevent Paho to send an ACK after processing a message from the broker?
I am working on a project with Paho on Java. Messages received from the broker are sent to an API that processes them, but this process might fail or take to long. I would like to take advantage of MQTT acknowledgement system and, in such cases, prevent the ACK to be sent so the broker resends the same messag…