Connect a data receiving IoT Application

Consume telemetry messages using Eclipse Hono Command Line Client

The telemetry data produced by devices is usually consumed by downstream applications that use it to implement their corresponding business functionality. In this example, we will use a simple command line client from the Eclipse Hono project that logs all telemetry messages to the console. All messages are routed to exactly one of the consumers and we attempt to balance the traffic load across the set of consumers using the same tenant. This routing delivers messages to consumers based on how quickly they settle the deliveries. Faster consumers get more messages.

  1. Make sure all required tools mentioned in the Prerequisites chapter are installed for your platform.

  2. Get the Eclipse Hono 0.9 Command Line Client.

  3. Start the example consumer.

    Make sure you set all parameters correctly:

    • {tenant-id} the ID of your tenant
    • {messaging-username} the username for the messaging endpoint (messaging@{tenant-id})
    • {messaging-password} the password for the messaging endpoint

    You can start the client by running the following command from folder you saved the binary to:

    Linux & Mac:

    java -jar hono-cli-<version>-exec.jar \
    --hono.client.host=messaging.bosch-iot-hub.com \
    --hono.client.port=5671 \
    --hono.client.tlsEnabled=true \
    --hono.client.username={messaging-username} \
    --hono.client.password={messaging-password} \
    --tenant.id={tenant-id} \
    --spring.profiles.active=receiver,telemetry
    

    Windows:

    java -jar hono-cli-<version>-exec.jar --hono.client.host=messaging.bosch-iot-hub.com --hono.client.port=5671 --hono.client.tlsEnabled=true --hono.client.username={messaging-username} --hono.client.password={messaging-password} --tenant.id={tenant-id} --spring.profiles.active=receiver,telemetry
    

    The consumer is ready when you see a ‘Receiver’ printed out on the console. Please be patient, as it can take up to 10 seconds for the consumer to become ready.

  4. The example consumer is now ready to receive messages. The next chapter will explain how a device will send messages to the Bosch IoT Hub.

Consume event messages using Hono Example Consumer

To receive event messages the same example consumer can be used. The same messaging endpoint and credentials can be used. But a different spring profile has to be used:

--spring.profiles.active=receiver,event