Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device does not wait for a response even specifying hono-ttd=60 #3466

Closed
Lando-Ant opened this issue Feb 15, 2023 · 6 comments
Closed

Device does not wait for a response even specifying hono-ttd=60 #3466

Lando-Ant opened this issue Feb 15, 2023 · 6 comments

Comments

@Lando-Ant
Copy link

I am using Eclipse Hono and I am experiencing an issue with hono-ttd, that is, when I launch the HTTP POST command from the device to send telemetry data by specifying e.g. hono-ttd=60, the device does not wait to receive a command instead it continues its execution. Moreover, I have no idea where to found the hono-cmd-req-id that should be returned by the device receiving the command.

This is the command I used to send telemetry data from the device:
curl -i -u [email protected]:demo-secret -H 'application/json' --data-binary '{ "topic": "org.eclipse.packages.c2e/demo-device/things/twin/commands/modify", "headers": {}, "path": "/features/temperature/properties/value", "value": 45 }' http://${HTTP_ADAPTER_IP}:${HTTP_ADAPTER_PORT_HTTP}/telemetry?hono-ttd=60
After sending the above telemetry data, I expect the device to wait for a command. Instead, the device does not wait and immediately returns:
HTTP/1.1 200 OK hono-command: modify-response content-type: application/vnd.eclipse.ditto+json content-length: 361

Thanks in advance for helping out!

@sophokles73
Copy link
Contributor

Your device already has received a (one-way) command from Ditto as indicated by the HTTP reponse's content-type application/vnd.eclipse.ditto+json. Ditto has sent this one-way command in response to your modify message. The HTTP response will only contain a hono-cmd-req-id header if an application sends a request-response command for which the application expects the device to send a response by means of POSTing to the HTTP adapter's /command/res/ resource (see https://www.eclipse.org/hono/docs/user-guide/http-adapter/#sending-a-response-to-a-command-authenticated-device).

If you want to see the device waiting for a command instead, you should send an empty-notifcation by means of POSTing an HTTP request with no payload to the HTTP adapter:

curl -XPOST -u [email protected]:demo-secret -H 'content-type: application/vnd.eclipse-hono-empty-notification' http://${HTTP_ADAPTER_IP}:${HTTP_ADAPTER_PORT_HTTP}/telemetry?hono-ttd=60

In this case, Ditto will not find any message to process and will therefore not send the one-way command acknowledging the modify message ...

@Lando-Ant
Copy link
Author

Lando-Ant commented Feb 16, 2023

Thank you @sophokles73, so how should I retrieve the hono-cmd-req-id?
The response should be something like this
`HTTP/1.1 200 OK
hono-command: start-watering
hono-cmd-req-id: 024d84b1ceb-797b-45f5-bc87-78e9b5396645replies
content-type: application/json
content-length: 516

{"topic":"org.eclipse.packages.c2e/demo-device/things/live/messages/start-watering","headers":{"correlation-id":"d84b1ceb-797b-45f5-bc87-78e9b5396645","x-forwarded-for":"10.244.0.1","version":2,"timeout":"0","x-forwarded-user":"ditto","accept":"/","x-real-ip":"10.244.0.1","x-ditto-dummy-auth":"nginx:ditto","host":"172.17.0.2:30385","content-type":"application/json","timestamp":"2020-02-28T08:04:43.518+01:00","user-agent":"curl/7.58.0"},"path":"/inbox/messages/start-watering","value":{"water-amount":"3liters"}}`
In which the hono-cmd-req-id appears too, but I only receive the response specified in my first comment.

@sophokles73
Copy link
Contributor

sophokles73 commented Feb 16, 2023

My understanding is that you are trying to follow the tour of the e2e Eclipse IoT package tour.

So can you please describe what exactly you are doing on both the device side as well as in the back end? What request(s) you send to the Hono HTTP adapter and what requests to you send to the Ditto HTTP API?

@Lando-Ant
Copy link
Author

Lando-Ant commented Feb 16, 2023

Simply I run
minikube start --driver=virtualbox
And after waiting for all the pods to be up and running, I run the command I posted in the first comment from a terminal. I expected the hono-cmd-req-id to appear in the output but it does not.

@sophokles73
Copy link
Contributor

@Lando-Ant is this still an issue?

@sophokles73
Copy link
Contributor

Please re-open if you still experience this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants