This module contains CLI tools for communication with Hono. This includes:
- a command-line client to interact with Hono's northbound APIs
- a command-line client to interact with Hono's AMQP protocol adapter.
The component is implemented as a Spring Boot application and can be configured with its configuration mechanisms and profiles.
For the available configuration options see the Hono Client Configuration.
Build the CLI:
# in directory hono/cli/
mvn clean install
cd target/
Receiving events and telemetry data from devices is enabled with the profile receiver
.
To send commands to a device, use the profile command
.
To enable Kafka based messaging, add the profile kafka
.
For instructions on how to get the addresses of the services and register devices please refer to the Getting Started Guide.
Receive events and telemetry data sent to the configured AMQP messaging network for a tenant:
# in directory hono/cli/target/
java -jar hono-cli-*-exec.jar --hono.client.host=$AMQP_NETWORK_IP --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --tenant.id=$MY_TENANT --spring.profiles.active=receiver
Send a command to a device over the configured AMQP messaging network:
# in directory hono/cli/target/
java -jar hono-cli-*-exec.jar --hono.client.host=$AMQP_NETWORK_IP --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --tenant.id=$MY_TENANT --device.id=$MY_DEVICE --spring.profiles.active=command
Receive events and telemetry data sent to the configured Kafka cluster for a tenant:
# in directory hono/cli/target/
java -jar hono-cli-*-exec.jar --hono.kafka.commonClientConfig.bootstrap.servers=$KAFKA_SERVERS --tenant.id=$MY_TENANT --spring.profiles.active=receiver,kafka
Send a command to a device over the configured Kafka cluster:
# in directory hono/cli/target/
java -jar hono-cli-*-exec.jar --hono.kafka.commonClientConfig.bootstrap.servers=$KAFKA_SERVERS --tenant.id=$MY_TENANT --device.id=$MY_DEVICE --spring.profiles.active=command,kafka
Please refer to the documentation of the AMQP Command-line Client for the usage of the CLI that can be used to connect to the AMQP protocol adapter.