为什么向 HTTP 协议适配器发送消息时出现 HTTP/1.1 503 Service Unavailable?
Why do I get HTTP/1.1 503 Service Unavailable when sending messages to the HTTP protocol adapter?
我向Eclipse Hono的HTTP协议适配器发布遥测数据时,一直报503错误码:
$ 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
可能是什么原因?
通常,在使用 Hono 进行试验时,很容易忘记在发送遥测或事件消息之前启动消费者。
来自 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.
还需要注意的是,消费者必须订阅对应的消息类型。消费者可以接收遥测和/或事件消息。发送的消息类型必须与消费者类型匹配。
我向Eclipse Hono的HTTP协议适配器发布遥测数据时,一直报503错误码:
$ 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
可能是什么原因?
通常,在使用 Hono 进行试验时,很容易忘记在发送遥测或事件消息之前启动消费者。 来自 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.
还需要注意的是,消费者必须订阅对应的消息类型。消费者可以接收遥测和/或事件消息。发送的消息类型必须与消费者类型匹配。