0

I'm trying to subscribe to the control topic. The mqtt adapter shows following logging when I subscribe:

14:28:47.933 [vert.x-eventloop-thread-0] DEBUG o.e.h.a.m.i.VertxBasedMqttProtocolAdapter - created subscription [tenant: tenant_aloxy, device: device-aloxy, filter: control/tenant_aloxy/device-aloxy/req/#, requested QoS: AT_MOST_ONCE, granted QoS: AT_MOST_ONCE]

When I publish messages to control/tenant_aloxy/device-aloxy/req//alp the device is not getting the message and I'm not getting any error logging in the hono mqtt adapter. However, when I subscribe to the topic myself using following command: qb message receive control/tenant_aloxy/device-aloxy/req/# -b amqp://user:secret@hostname:5672, I'm getting the messages. Any idea where to look?

The Hono version I'm currently using is from commit https://github.com/eclipse/hono/commit/78979346212446dc6cf8b8b3255f048e19e81210

UPDATE
I updated Hono to version 0.9-M2 and still have the same problem. The logging when subscribing is the following:

12:21:02.407 [vert.x-eventloop-thread-0] INFO  o.e.h.s.m.LoggingConnectionEventProducer -    Connected - ID: device_interface_client_b24704c9-ed11-41af-a0e0-ba90264a7362, Protocol Adapter: hono-mqtt, Device: device [device-id: device-aloxy, tenant-id: tenant_aloxy], Data: null
12:21:02.515 [vert.x-eventloop-thread-0] DEBUG o.e.h.client.impl.AbstractHonoClient - receiver open [source: control/tenant_aloxy/device-aloxy]
12:21:02.515 [vert.x-eventloop-thread-0] DEBUG o.e.hono.client.CommandConsumer - successfully created command consumer [control/tenant_aloxy/device-aloxy]
12:21:02.517 [vert.x-eventloop-thread-0] DEBUG o.e.h.a.m.i.VertxBasedMqttProtocolAdapter - created subscription [tenant: tenant_aloxy, device: device-aloxy, filter: control/+/+/req/#, requested QoS: AT_MOST_ONCE, granted QoS: AT_MOST_ONCE]

I publish my messages to queue control/tenant_aloxy/device-aloxy/req//alp

UPDATE 2
I discovered something strange. Following screenshot shows the metrics from an enmasse perspective: Enmasse view on connection

It shows that several messages have been published to the queue but have been rejected by the Hono MQTT Adapter. However, I do not see any logging for these messages in the console although SPRINT_PROFILE "dev" is activated.

Bob Claerhout
  • 781
  • 5
  • 24
  • Have you tried if it works with 0.9-M2? Also, I am not familiar (yet) with the qb command line tool which you seem to use. Can you point out where it comes from? – Kai Hudalla Jan 28 '19 at 07:31
  • qb is short for Qpid-bow (https://pypi.org/project/qpid-bow/). You can use it to easily subscribe or publish from/to AMQP 1.0 queues/topics. I haven't tried 0.9-M2 yet, I am not using the latest version because it was not stable a month ago. Will try if this fixes it. – Bob Claerhout Jan 28 '19 at 09:37
  • @KaiHudalla, updated to 0.9-M2. Will update original question with logging – Bob Claerhout Jan 28 '19 at 12:30
  • @KaiHudalla, I updated it again with something I noticed in the enmasse GUI. – Bob Claerhout Jan 28 '19 at 13:29

2 Answers2

0

An authenticated device must use the topic filter control/+/+/req/# to subscribe for commands. If the device is unauthenticated then control/${tenant-id}/{device-id}/req/# to be used.

If the device device-aloxy is authenticated, then subscribe to topic control/+/+/req/# and try sending commands.

kaniyan
  • 1,391
  • 1
  • 7
  • 7
  • Does not work either. I'm getting following logging: `09:48:00.910 [vert.x-eventloop-thread-0] DEBUG o.e.hono.client.CommandConsumer - successfully created command consumer [control/tenant_aloxy/device-aloxy] 09:48:00.910 [vert.x-eventloop-thread-0] DEBUG o.e.h.a.m.i.VertxBasedMqttProtocolAdapter - created subscription [tenant: tenant_aloxy, device: device-aloxy, filter: control/+/+/req/#, requested QoS: AT_MOST_ONCE, granted QoS: AT_MOST_ONCE]` The [documentation]((https://www.eclipse.org/hono/concepts/command-and-control/)) states that it should typically subscribe with wildcards – Bob Claerhout Jan 28 '19 at 09:49
0

I think that you are publishing to the wrong address. Please also keep in mind that the applications sending commands are not publishing to a topic (that's MQTT parlais) but instead send an AMQP message to a remote node which is identified by an address.

That said, your application should send the command over a sender link with a target address of control/tenant_aloxy/device-aloxy (see Preconditions of https://www.eclipse.org/hono/api/command-and-control-api/#send-a-one-way-command). Note that the target address is different from the MQTT topic name that the device subscribes to.

If you are expecting a response then you also need to open a receiver link and include the receiver link's source address as the value of the reply-to property in the command message (as described in https://www.eclipse.org/hono/api/command-and-control-api/#send-a-request-response-command).

Kai Hudalla
  • 826
  • 1
  • 5
  • 7
  • I was indeed publishing to the wrong address. The message is now getting delivered to the right queue. However, it is being rejected as stated in the last update of the question – Bob Claerhout Jan 28 '19 at 14:46
  • The command message is rejected when it is malformed. Can you double check that the command message that your application sends indeed contains all required information as defined in https://www.eclipse.org/hono/api/command-and-control-api/ ? Maybe you forgot to set a subject (i.e. command name) or your AMQP client does not set a message ID? BTW are you sending a one-way command or a request/response command? – Kai Hudalla Jan 29 '19 at 08:44
  • I have just verified the sending of one-way commands to device subscribed with the MQTT protocol adapter using the Hono Sandbox at hono.eclipse.org. I have used the command line client provided by Hono for sending the commands: `java -jar hono-cli-0.9-SNAPSHOT-exec.jar --hono.client.host=hono.eclipse.org --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --spring.profiles.active=command` Works as expected. – Kai Hudalla Jan 29 '19 at 09:24
  • I figured it out. Even when all properties are set, you have to make sure to pass the payload, subject and id as a unicode string. Otherwise, the mqtt adapter will fail. Because you have to set the properties on the message and they are not part of the message, you cannot use the qb command line tool to test these messages.(i.e.: when receiving the messages you have to look at the debug output. When sending the messages, you cannot set these properties.) – Bob Claerhout Jan 29 '19 at 13:26