Search code examples
mqtteclipse-hono

How do I start Eclipse-Hono client in MQTT?


I'm having trouble in starting MQTT Client in Eclipse Hono.
I'm using The following command to start the client

java -jar hono-example-0.6-exec.jar --hono.client.host=hono.eclipse.org --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --spring.profiles.active=receiver --tenant.id=bob 

which starts the client accepting telemetry data produced by the device, but didn't catch the data published through MQTT.

What may be wrong with this approach?


Solution

  • The command you are using does not start an MQTT client but starts the receiver for consuming (AMQP 1.0) messages from devices belonging to tenant bob. In order to see something happening, you need to have a device that belongs to tenant bob publish some data. If you want to use MQTT for that purpose you may want to use the mosquitto_pub command line client as described in the Getting Started guide. However, make sure that you use the correct username and password. From what I can see in the device registry on hono.eclipse.org you have registered a device with id 1112 and auth-id sensor1. So the command to publish should look something like:

    mosquitto_pub -h hono.eclipse.org -u sensor1@bob -Pthepasswordyouregistered -t telemetry -m "hello"
    

    Again, make sure to replace thepasswordyouregistered with the real password that you have registered for device 1112.