2

我正在测试 Eclipse IoT Cloud2Edge 包的部署,并按照此处的说明https://www.eclipse.org/packages/packages/cloud2edge/tour/进行测试。创建新租户和设备,并配置 Hono 和 Ditto 之间的连接后,我可以通过 Hono http 适配器向新设备发送遥测数据,如下所示:

curl -i -u my-auth-id-1@my-tenant:my-password -H 'application/json' --data-binary '{
  "topic": "my-tenant/org.acme:my-device-1/things/twin/commands/modify",
  "headers": {},
  "path": "/features/temperature/properties/value",
  "value": 53
}' http://${HTTP_ADAPTER_IP}:${HTTP_ADAPTER_PORT_HTTP}/telemetry
HTTP/1.1 202 Accepted
vary: origin
content-length: 0

并希望看到此属性值在同上更新。更新的设备属性值不会在同上更新,当我检查同上日志时,我看到以下条目:

2022-02-13 20:11:35,265 INFO  [] o.e.d.c.s.m.a.AmqpConsumerActor akka://ditto-cluster/system/sharding/connection/3/hono-connection-for-my-tenant/pa/$a/c1/amqpConsumerActor-0-telemetry%2Fmy-tenant-010 - Received message from AMQP 1.0 with externalMessageHeaders: {orig_adapter=hono-http, qos=0, device_id=org.acme:my-device-1, creation-time=1644783095260, message-id=ID:AMQP_NO_PREFIX:GenericSenderLink-12, content-type=application/x-www-form-urlencoded, to=telemetry/my-tenant, orig_address=/telemetry}
2022-02-13 20:11:35,271 INFO  [81c41f10-4d59-435b-8ae1-bf5194dcf6bf] o.e.d.c.s.m.InboundDispatchingSink  - onMapped mappedHeaders ImmutableDittoHeaders [{ditto-entity-id=thing:my-tenant:org.acme:my-device-1, ditto-inbound-payload-mapper=default, content-type=application/x-www-form-urlencoded, hono-device-id=org.acme:my-device-1, ditto-reply-target=0, ditto-expected-response-types=["response","error"], ditto-origin=hono-connection-for-my-tenant, ditto-auth-context={"type":"pre-authenticated-connection","subjects":["pre-authenticated:hono-connection"]}, correlation-id=81c41f10-4d59-435b-8ae1-bf5194dcf6bf}]
2022-02-13 20:11:35,278 INFO  [b3b11410-6df8-4bfc-a940-fafa87d65be2] o.e.d.c.s.m.InboundDispatchingSink  - Got exception <connectivity:connection.id.enforcement.failed> when processing external message with mapper <default>: <The configured filters could not be matched against the given target with ID 'org.acme:my-device-1'.>
2022-02-13 20:11:35,278 INFO  [b3b11410-6df8-4bfc-a940-fafa87d65be2] o.e.d.c.s.m.InboundDispatchingSink  - Resolved mapped headers of ImmutableDittoHeaders [{ditto-inbound-payload-mapper=default, ditto-entity-id=thing:my-tenant:org.acme:my-device-1, response-required=false, content-type=application/x-www-form-urlencoded, hono-device-id=org.acme:my-device-1, ditto-reply-target=0, ditto-expected-response-types=["response","error"], ditto-origin=hono-connection-for-my-tenant, ditto-auth-context={"type":"pre-authenticated-connection","subjects":["pre-authenticated:hono-connection"]}, correlation-id=b3b11410-6df8-4bfc-a940-fafa87d65be2}] : with HeaderMapping Optional[ImmutableHeaderMapping [mapping={hono-device-id={{ header:device_id }}, content-type={{ header:content-type }}}]] : and external headers {orig_adapter=hono-http, qos=0, device_id=org.acme:my-device-1, creation-time=1644783095260, message-id=ID:AMQP_NO_PREFIX:GenericSenderLink-12, content-type=application/x-www-form-urlencoded, to=telemetry/my-tenant, orig_address=/telemetry}
2022-02-13 20:11:35,283 INFO  [] o.e.d.c.s.m.a.AmqpConsumerActor akka://ditto-cluster/system/sharding/connection/3/hono-connection-for-my-tenant/pa/$a/c1/amqpConsumerActor-0-telemetry%2Fmy-tenant-010 - Acking <ID:AMQP_NO_PREFIX:GenericSenderLink-12> with original external message headers=<{orig_adapter=hono-http, qos=0, device_id=org.acme:my-device-1, creation-time=1644783095260, message-id=ID:AMQP_NO_PREFIX:GenericSenderLink-12, content-type=application/x-www-form-urlencoded, to=telemetry/my-tenant, orig_address=/telemetry}>, isSuccess=<true>, ackType=<1 accepted>

我认为问题是“connectivity:connection.id.enforcement.failed”错误,但我不知道如何排除故障。任何建议表示赞赏。

4

1 回答 1

2

您配置的是连接源强制执行,它确保 Hono 设备(通过 AMQP 标头标识device_id)只能更新同上中具有相同“事物 id”的孪生。

该强制执行失败,因为您在同上协议 JSON 中设置的 thingId 是my-tenant:org.acme:my-device-1- 的topic第一个段是名称空间,第二个段是名称 - 将这两个段组合成“事物 ID”,另请参见:协议主题规范。

因此,您可能希望发送以下消息:

{
  "topic": "org.acme/my-device-1/things/twin/commands/modify",
...
}
于 2022-02-14T07:56:04.790 回答