Discontinued Java SDK and Alternatives?

Hiya,
I noticed that the Java SDK has been discontinued sometime in early Dec 2019. I was wondering if anyone has managed to successfully use an alternative or whether it is even possible.

I attempted using Eclipse Paho (I’m new to this) and I keep getting a “not authorised to connect” error message, but I guess it is because I have not provided the correct format/parameters to get the MqttClient to connect to TTN. Would really appreciate some guidance on how to get started, thank you!

The SDK was just a wrapper around the other APIs, which use common techniques themselves. So, yes, MQTT is a good choice for the data, and that will also work in V3.

The SDK shows how to use MQTT, which according to its POM uses Paho as well. It also uses some magic to get the broker address given just some region, but one could just configure the full broker address without that magic.

To solve your authorisation error I’d first use some standalone MQTT client to ensure you’re using the correct credentials. See the documentation on using mosquito_sub as an example. For me, on a Mac, the following works just fine (on Windows you need some extra quotes, as noted in the documentation), without TLS, using the default port 1883:

mosquitto_sub \
  -h eu.thethings.network \
  -t +/devices/+/up \
  -u haarlem-app-1 \
  -P ttn-account-v2.ko3<redacted>fyr-A

To use TLS in Mosquitto you also need the root certificate chain that’s listed in the documentation, as used by the Let’s Encrypt server certificate. I think that might already be supported in an up-to-date Java SDK? With that downloaded mqtt-ca.pem, using the default port 8883:

mosquitto_sub \
  -h eu.thethings.network \
  --cafile mqtt-ca.pem \
  -t +/devices/+/up \
  -u haarlem-app-1 \
  -P ttn-account-v2.ko3<redacted>fyr-A
1 Like

Thanks for this. I’ll give it a try.

I made use of some of the components of the now-deprecated Java SDK, modified it a bit, and tried out your suggestion to resolve the authorisation error.
image

It worked! :smile: Thank you for your help!