Discontinued Java SDK and Alternatives?

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