【问题标题】:Sending data from Hono to Ditto将数据从 Hono 发送到同上
【发布时间】:2019-10-14 13:27:49
【问题描述】:

Eclipse Hono 和 Eclipse Ditto 已成功连接。当我尝试从 Hono 发送数据时,我会得到 202 Accepted 响应,如下所示。

(base) vignesh@nb907:~$ curl -X POST -i -u sensor9200@tenantSensorAdaptersss:mylittle -H 'Content- 
Type: application/json' -d '{"temp": 23.07, "hum": 45.85122}'  http://localhost:8080/telemetry
HTTP/1.1 202 Accepted
content-length: 0 

但是当我使用 localhost:8080/api/2/testing.ditto:9200 检查数字孪生值时 - 它没有得到更新。

我在查询日志时遇到了错误。

connectivity_1   | 2019-10-14 15:18:26,273 INFO  [ID:AMQP_NO_PREFIX:TelemetrySenderImpl-7] 
o.e.d.s.c.m.a.AmqpPublisherActor akka://ditto- 
cluster/system/sharding/connection/27/Amma123465/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=9200, correlation-id=ID:AMQP_NO_PREFIX:TelemetrySenderImpl-7}, 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":"9200","correlation- 
id":"ID:AMQP_NO_PREFIX:TelemetrySenderImpl-7"},"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']
gateway_1        | 2019-10-14 15:19:47,927 WARN  [b9774050-48ae-45c4-a937-68a70f8defe5] 
o.e.d.s.g.s.a.d.DummyAuthenticationProvider  - Dummy authentication has been applied for the following 
subjects: nginx:ditto
gateway_1        | 2019-10-14 15:19:47,949 INFO  [b9774050-48ae-45c4-a937-68a70f8defe5] 
o.e.d.s.m.c.a.ConciergeForwarderActor akka://ditto-cluster/user/gatewayRoot/conciergeForwarder - 
Sending signal with ID <testing.ditto:9200> and type <things.commands:retrieveThing> to concierge- 
shard-region
gateway_1        | 2019-10-14 15:19:48,044 INFO  [b9774050-48ae-45c4-a937-68a70f8defe5] 
o.e.d.s.g.e.HttpRequestActor akka://ditto-cluster/user/$C - DittoRuntimeException 
<things:precondition.notmodified>: <The comparison of precondition header 'if-none-match' for the 
requested Thing resource evaluated to false. Expected: '"rev:1"' not to match actual: '"rev:1"'.>.

我已经设置了所有的 json 字段。但不确定我错过了什么。

我也可以在日志中看到这个

nginx_1          | 172.18.0.1 - ditto [14/Oct/2019:13:19:48 +0000] "GET 
/api/2/things/testing.ditto:9200 HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

如果我遗漏了什么,请告诉我。

【问题讨论】:

标签: eclipse-hono eclipse-ditto eclipse-iot


【解决方案1】:

您是使用 Ditto 协议发送消息还是应用了有效负载转换? 看起来像 Connecting Eclipse Hono to Ditto - "description":"Check if all required JSON fields were set."},"status":400}" Error 的副本,您之前遇到过同样的问题和错误。

【讨论】:

  • 感谢您的回复。我确实在同上协议中发送了消息。
  • 错误消息JSON did not include required &lt;/path&gt; field! 表示同上协议消息中所需的“路径”字段丢失。从您的 cURL 我只看到您发送 -d '{"temp": 23.07, "hum": 45.85122}' - 这不是同上协议消息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-16
  • 1970-01-01
  • 1970-01-01
  • 2014-09-24
  • 2011-01-14
相关资源
最近更新 更多