无法创建 STH 上下文代理订阅
Unable to create the STH context broker subscription
我正在使用 sth-comet's github repo 的主分支(目前是 2.0.0-next
的预发布版),我能够安装和执行它。当我想在上下文代理 (v1.4.0) 上创建订阅时出现问题。这两种服务都安装在同一台 FIWARE 实验室机器上,我使用 public IP 地址远程访问它们。
我一直在尝试使用您 documentation 中提供的模板创建订阅,但 STH 总是抱怨 FIWARE-Service
和 FIWARE-ServicePath
headers(似乎上下文代理没有将它们与通知一起发送)。这是创建订阅的命令:
curl http://$(server):1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @- <<EOF
{
"entities": [
{
"type": "weather.station",
"isPattern": "true",
"id": ".*"
}
],
"attributes": [
"temperature",
"humidity"
],
"reference": "http://$(server):8666/notify",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"temperature",
"humidity"
]
}
],
"throttling": "PT5S"
}
EOF
这是报告的错误:
time=2016-10-06T15:56:30.124Z | lvl=WARN | corr=7220efae-8bdd-11e6-96a8-fa163ea89c59 | trans=11ef935c-f749-46b7-bcd4-942ffddedd27 | op=OPER_STH_POST | srv=default | subsrv=n/a | msg=POST /notify, event={"request":"1475769390111:robots:23181:ityixskh:10000","timestamp":1475769390123,"tags":["validation","error","headers"],"data":{"data":{"data":null,"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]"},"headers":{}}},"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]","validation":{"source":"headers","keys":[]}},"headers":{}}},"internal":true}
如果我使用上下文代理的 v2 API,我可以强制它发送 FIWARE-Service
和 FIWARE-ServicePath
headers:
curl http://$(server):1026/v2/subscriptions -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @- <<EOF
{
"description": "STH subscription",
"subject": {
"entities": [
{
"type": "weather.station",
"idPattern": ".*"
}
],
"condition": {
"attrs":[
"temperature",
"humidity"
]
}
},
"notification": {
"httpCustom": {
"url": "http://$(server):8666/notify",
"headers": {
"FIWARE-Service": "default",
"FIWARE-ServicePath": "/"
}
},
"attrs": [
"temperature",
"humidity"
]
},
"expires": "2018-04-05T14:00:00.00Z",
"throttling": 5
}
EOF
这样,STH 服务器不符合 headers,尽管它会引发其他错误:
time=2016-10-06T15:46:57.564Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=1b7fc29a-7f5c-449d-9238-d2e644154b05 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event={"request":"1475768812582:robots:8985:itycaq0o:10003","timestamp":1475768817564,"tags":["request","closed","error"],"internal":true}
time=2016-10-06T15:47:02.592Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=7e5bf417-0b1d-4b53-b47b-838cead91b94 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event={"request":"1475768817606:robots:8985:itycaq0o:10004","timestamp":1475768822592,"tags":["request","closed","error"],"internal":true}
首先,非常感谢您使用STH组件;)
问题似乎与 Orion Context Broker 有关,如果服务路径为空或默认路径(即 /
).我刚刚在 Orion Context Broker 存储库中创建了一个问题来处理它,以防你也想跟踪它:https://github.com/telefonicaid/fiware-orion/issues/2584
如果您使用任何其他有效的服务路径,一切都应该没问题。
再次感谢您!
最好的,德语。
我正在使用 sth-comet's github repo 的主分支(目前是 2.0.0-next
的预发布版),我能够安装和执行它。当我想在上下文代理 (v1.4.0) 上创建订阅时出现问题。这两种服务都安装在同一台 FIWARE 实验室机器上,我使用 public IP 地址远程访问它们。
我一直在尝试使用您 documentation 中提供的模板创建订阅,但 STH 总是抱怨 FIWARE-Service
和 FIWARE-ServicePath
headers(似乎上下文代理没有将它们与通知一起发送)。这是创建订阅的命令:
curl http://$(server):1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @- <<EOF
{
"entities": [
{
"type": "weather.station",
"isPattern": "true",
"id": ".*"
}
],
"attributes": [
"temperature",
"humidity"
],
"reference": "http://$(server):8666/notify",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"temperature",
"humidity"
]
}
],
"throttling": "PT5S"
}
EOF
这是报告的错误:
time=2016-10-06T15:56:30.124Z | lvl=WARN | corr=7220efae-8bdd-11e6-96a8-fa163ea89c59 | trans=11ef935c-f749-46b7-bcd4-942ffddedd27 | op=OPER_STH_POST | srv=default | subsrv=n/a | msg=POST /notify, event={"request":"1475769390111:robots:23181:ityixskh:10000","timestamp":1475769390123,"tags":["validation","error","headers"],"data":{"data":{"data":null,"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]"},"headers":{}}},"isBoom":true,"isServer":false,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"child \"fiware-servicepath\" fails because [fiware-servicepath is required]","validation":{"source":"headers","keys":[]}},"headers":{}}},"internal":true}
如果我使用上下文代理的 v2 API,我可以强制它发送 FIWARE-Service
和 FIWARE-ServicePath
headers:
curl http://$(server):1026/v2/subscriptions -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'FIWARE-Service: default' -H 'FIWARE-ServicePath: /' -d @- <<EOF
{
"description": "STH subscription",
"subject": {
"entities": [
{
"type": "weather.station",
"idPattern": ".*"
}
],
"condition": {
"attrs":[
"temperature",
"humidity"
]
}
},
"notification": {
"httpCustom": {
"url": "http://$(server):8666/notify",
"headers": {
"FIWARE-Service": "default",
"FIWARE-ServicePath": "/"
}
},
"attrs": [
"temperature",
"humidity"
]
},
"expires": "2018-04-05T14:00:00.00Z",
"throttling": 5
}
EOF
这样,STH 服务器不符合 headers,尽管它会引发其他错误:
time=2016-10-06T15:46:57.564Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=1b7fc29a-7f5c-449d-9238-d2e644154b05 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event={"request":"1475768812582:robots:8985:itycaq0o:10003","timestamp":1475768817564,"tags":["request","closed","error"],"internal":true}
time=2016-10-06T15:47:02.592Z | lvl=ERROR | corr=19e59f02-8bdc-11e6-8534-fa163ea89c59 | trans=7e5bf417-0b1d-4b53-b47b-838cead91b94 | op=OPER_STH_POST | srv=default | subsrv=/ | msg=POST /notify, event={"request":"1475768817606:robots:8985:itycaq0o:10004","timestamp":1475768822592,"tags":["request","closed","error"],"internal":true}
首先,非常感谢您使用STH组件;)
问题似乎与 Orion Context Broker 有关,如果服务路径为空或默认路径(即 /
).我刚刚在 Orion Context Broker 存储库中创建了一个问题来处理它,以防你也想跟踪它:https://github.com/telefonicaid/fiware-orion/issues/2584
如果您使用任何其他有效的服务路径,一切都应该没问题。
再次感谢您!
最好的,德语。