I spent quite some time trying to figure out how to connect to a Kapua back end with anything other than a Kura client and could not find a satisfactory answer. This despite the fantastic efforts of community members like Ctron. I was looking for a simple non-Kura option, something that went beyond Kura simulators and the like.
Given that Kapua offers what is a MQTT interface as one of its connectivity options, one would have expected Paho or any good MQTT client solution to work I was quite frustrated to find using a simple Node-Red mqtt node did not quite work initially. The following is learning and the code that finally got it all working:
Things that I learnt:
- You need to figure out where your Kapua Broker logs are being stored and watch them closely as you get your installation running. It is exhaustive and an excellent debugging option
- If you use username password authentication as I am initially, you need to get your user roles and permissions right in the Kapua console
- Once I had solved all the problems around getting the message to the broker, I saw this persistent but inexplicable message around unprocessable messages from Camel. Using mqtt-spy I eventually figured out that Kapua does not depend on Kura but has standardized on the Google ProtoBuf based data format for message encoding over MQTT
- You need to honor Kapua / Kura topic naming semantics - at the very least your topic names should be in the form:
/ {account-name}/{client-id}/{app-id}
Java source
Contents of pom.xml
Things to do: Check out https://www.eclipse.org/kapua/docs/0.3.0/developer-guide/en/client.html
No comments:
Post a Comment