Search code examples
eclipse-hono

Why do I get HTTP/1.1 503 Service Unavailable when sending messages to the HTTP protocol adapter?


I keep getting the error code 503 all the time when I publish telemetry data to the HTTP protocol adapter of Eclipse Hono:

$ curl -i -u sensor1@DEFAULT_TENANT:hono-secret -H 'Content-Type: application/json' --data-binary '{"temp": 5}' http://hono.eclipse.org:8080/telemetry
HTTP/1.1 503 Service Unavailable
retry-after: 2
content-type: text/plain; charset=utf-8
content-length: 23

temporarily unavailable

What would probably be the reason?


Solution

  • Usually, when experimenting with Hono it is easy to forget to start a consumer before sending telemetry or event messages. From Hono's homepage:

    If you haven’t started the application you will always get 503 Resource Unavailable responses because Hono does not accept any telemetry data from devices if there aren’t any consumers connected that are interested in the data. The reason for this is that Hono never persists Telemetry data and thus it doesn’t make any sense to accept and process telemetry data if there is no consumer to deliver it to.

    It should also be noted that the consumer must be subscribed to the corresponding message type. A consumer can receive either telemetry or event messages, or both. The type of message sent must match the type of consumer.