我成功地能够使用 AMQP 适配器将 Hono 连接到 Ditto,并且在日志中收到以下消息。在 Hono 中注册的演示设备发送的值被成功接收并在 Ditto 事物中更新。
connectivity_1_ad306c4c315b | 2019-07-08 21:12:05,434 INFO [ID:AMQP_NO_PREFIX:TelemetrySenderImpl-35] o.e.d.s.c.m.a.AmqpPublisherActor akka://ditto-cluster/system/sharding/connection/1/Insight-connection-1/pa/$a/c1/amqpPublisherActor2 - Response dropped, missing replyTo address: UnmodifiableExternalMessage [headers={orig_adapter=hono-http, device_id=4716, correlation-id=ID:AMQP_NO_PREFIX:TelemetrySenderImpl-35, content-type=application/vnd.eclipse.ditto+json, etag="hash:18694a24", orig_address=/telemetry, source=nginx:ditto}, response=true, error=false, authorizationContext=null, topicPath=ImmutableTopicPath [namespace=org.eclipse.ditto, id=4716, group=things, channel=twin, criterion=commands, action=modify, subject=null, path=org.eclipse.ditto/4716/things/twin/commands/modify], enforcement=null, headerMapping=null, sourceAddress=null, payloadType=TEXT, textPayload={"topic":"org.eclipse.ditto/4716/things/twin/commands/modify","headers":{"orig_adapter":"hono-http","device_id":"4716","correlation-id":"ID:AMQP_NO_PREFIX:TelemetrySenderImpl-35","content-type":"application/vnd.eclipse.ditto+json","etag":"\"hash:18694a24\"","orig_address":"/telemetry","source":"nginx:ditto"},"path":"/features","value":null,"status":204}, bytePayload=null']
things-search_1_8f2ad3dda4bf | 2019-07-08 21:12:05,593 INFO [] o.e.d.s.t.p.w.s.EnforcementFlow - Updating search index of <1> things
things-search_1_8f2ad3dda4bf | 2019-07-08 21:12:05,598 INFO [] o.e.d.s.t.p.w.s.EnforcementFlow - Got SudoRetrieveThingResponse <1> times
things-search_1_8f2ad3dda4bf | 2019-07-08 21:12:05,725 INFO [] a.s.Materializer akka.stream.Log(akka://ditto-cluster/user/thingsSearchRoot/searchUpdaterRoot/StreamSupervisor-21) - [SearchUpdaterStream/BulkWriteResult] Element: BulkWriteResult[matched=1,upserts=0,inserted=0,modified=1,deleted=0]
但是当我尝试建立新连接时(Hono - 安装在不同的服务器上,并且托管在上述成功连接的同一服务器上)。连接已建立,并且当我尝试将消息从在 Hono 中注册的演示设备发送到同上时。我得到以下回应。
vigkam@srvgal89:~$ curl -X POST -i -u sensor0101@tenantAdapters:mylittle -H 'Content-Type: application/json' -d '{"temp": 23.09, "hum": 45.85}' http://srvgal89.deri.ie:8080/telemetry
HTTP/1.1 202 Accepted
content-length: 0
当我尝试检索连接指标时,我可以看到指标计数相对于从 Hono 发送的消息数量的增加。
但唯一的问题是传感器值(上述 curl 命令中的温度和湿度)没有在同上的事情中得到更新。
我在日志中收到以下错误消息,上面写着“描述”:“检查是否设置了所有必需的 JSON 字段。”},“状态”:400}“
connectivity_1_ad306c4c315b | 2019-07-08 21:34:17,640 INFO [ID:AMQP_NO_PREFIX:TelemetrySenderImpl-13] o.e.d.s.c.m.a.AmqpPublisherActor akka://ditto-cluster/system/sharding/connection/23/Gal-Connection-10/pa/$a/c1/amqpPublisherActor2 - Response dropped, missing replyTo address: UnmodifiableExternalMessage [headers={content-type=application/vnd.eclipse.ditto+json, orig_adapter=hono-http, orig_address=/telemetry, device_id=4816, correlation-id=ID:AMQP_NO_PREFIX:TelemetrySenderImpl-13}, response=true, error=true, authorizationContext=null, topicPath=ImmutableTopicPath [namespace=unknown, id=unknown, group=things, channel=twin, criterion=errors, action=null, subject=null, path=unknown/unknown/things/twin/errors], enforcement=null, headerMapping=null, sourceAddress=null, payloadType=TEXT, textPayload={"topic":"unknown/unknown/things/twin/errors","headers":{"content-type":"application/vnd.eclipse.ditto+json","orig_adapter":"hono-http","orig_address":"/telemetry","device_id":"4816","correlation-id":"ID:AMQP_NO_PREFIX:TelemetrySenderImpl-13"},"path":"/","value":{"status":400,"error":"json.field.missing","message":"JSON did not include required </path> field!","description":"Check if all required JSON fields were set."},"status":400}, bytePayload=null']
如果我遗漏了什么,请告诉我。先感谢您。!!
更多信息:Ditto 中的 thingId 是 org.eclipse.ditto:4816,Hono 中的租户 ID -tenantAdapters,Hono 中注册的设备 - 4816(tenantAdapters),设备的 Auth Id - sensor0101,Hono 和 Ditto 之间的 ConnectionId - Gal-Connection -10