FIWARE - Orion Context Broker - 无法创建订阅 - 缺少回调
FIWARE - Orion Context Broker - Cannot create subscription - Callback is missing
我正在使用 Orion Context Broker 并尝试添加新订阅,但我收到一个错误消息,指出回调丢失,即使我已经提供了回调。
这是我拥有的实体
$ curl localhost:1026/v2/entities -s -S --header 'Accept: application/json' | python -mjson.tool
[
{
"id": "Room1",
"pressure": {
"metadata": {},
"type": "Integer",
"value": 720
},
"temperature": {
"metadata": {},
"type": "Float",
"value": 23
},
"type": "Room"
},
{
"id": "Room2",
"pressure": {
"metadata": {},
"type": "Integer",
"value": 711
},
"temperature": {
"metadata": {},
"type": "Float",
"value": 21
},
"type": "Room"
}
]
这里是创建新订阅的调用和后续错误:
$ curl -v localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' \
> -d @- <<EOF
> {
> "description": "A subscription to get info about Room1",
> "subject": {
> "entities": [
> {
> "id": "Room1",
> "type": "Room"
> }
> ],
> "condition": {
> "attributes": ["temperature"]
> }
> },
> "notification": {
> "http": {
> "url": "http://localhost:1028/accumulate"
> },
> "attrs": [
> "temperature",
> "pressure"
> ]
> },
> "expires": "2040-01-01T14:00:00.00Z",
> "throttling": 5
> }
> EOF
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 1026 (#0)
> POST /v2/subscriptions HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:1026
> Accept: */*
> Content-Type: application/json
> Content-Length: 417
>
* upload completely sent off: 417 out of 417 bytes
< HTTP/1.1 400 Bad Request
< Connection: Keep-Alive
< Content-Length: 58
< Content-Type: application/json
< Date: Mon, 08 Aug 2016 10:11:39 GMT
<
* Connection #0 to host localhost left intact
{"error":"BadRequest","description":"callback is missing"}
首先,创建实体的请求(POST /v2/entities)不接受实体向量,而是接受单个对象。该请求应该给出一个错误(不幸的是,代理以 JSON 解析错误 响应,这不是 100% 正确)。将请求更改为仅创建 Room1,如果还想创建 Room2,请添加另一个请求。
现在,订阅的创建看起来不错。我 运行 根据您的确切要求进行了测试,效果很好。
现在,为了尝试理解您的问题,我请您在问题描述中添加一些信息:
- 您使用的是哪个版本的 Orion 上下文代理? (使用:
curl localhost:1026/version
)——你可能想更新到更新的版本,以防它太旧(1.2.0 是最新版本)。
- 您的经纪人在收到创建订阅的请求时生成的跟踪。 (使用:
cat /tmp/contextBroker.log
)。如果您自己启动代理,请在所有跟踪开启的情况下启动它(使用选项:-t 0-255 -logLevel DEBUG
)
最后,很抱歉耽搁了,请假...
我正在使用 Orion Context Broker 并尝试添加新订阅,但我收到一个错误消息,指出回调丢失,即使我已经提供了回调。
这是我拥有的实体
$ curl localhost:1026/v2/entities -s -S --header 'Accept: application/json' | python -mjson.tool
[
{
"id": "Room1",
"pressure": {
"metadata": {},
"type": "Integer",
"value": 720
},
"temperature": {
"metadata": {},
"type": "Float",
"value": 23
},
"type": "Room"
},
{
"id": "Room2",
"pressure": {
"metadata": {},
"type": "Integer",
"value": 711
},
"temperature": {
"metadata": {},
"type": "Float",
"value": 21
},
"type": "Room"
}
]
这里是创建新订阅的调用和后续错误:
$ curl -v localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' \
> -d @- <<EOF
> {
> "description": "A subscription to get info about Room1",
> "subject": {
> "entities": [
> {
> "id": "Room1",
> "type": "Room"
> }
> ],
> "condition": {
> "attributes": ["temperature"]
> }
> },
> "notification": {
> "http": {
> "url": "http://localhost:1028/accumulate"
> },
> "attrs": [
> "temperature",
> "pressure"
> ]
> },
> "expires": "2040-01-01T14:00:00.00Z",
> "throttling": 5
> }
> EOF
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 1026 (#0)
> POST /v2/subscriptions HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:1026
> Accept: */*
> Content-Type: application/json
> Content-Length: 417
>
* upload completely sent off: 417 out of 417 bytes
< HTTP/1.1 400 Bad Request
< Connection: Keep-Alive
< Content-Length: 58
< Content-Type: application/json
< Date: Mon, 08 Aug 2016 10:11:39 GMT
<
* Connection #0 to host localhost left intact
{"error":"BadRequest","description":"callback is missing"}
首先,创建实体的请求(POST /v2/entities)不接受实体向量,而是接受单个对象。该请求应该给出一个错误(不幸的是,代理以 JSON 解析错误 响应,这不是 100% 正确)。将请求更改为仅创建 Room1,如果还想创建 Room2,请添加另一个请求。
现在,订阅的创建看起来不错。我 运行 根据您的确切要求进行了测试,效果很好。
现在,为了尝试理解您的问题,我请您在问题描述中添加一些信息:
- 您使用的是哪个版本的 Orion 上下文代理? (使用:
curl localhost:1026/version
)——你可能想更新到更新的版本,以防它太旧(1.2.0 是最新版本)。 - 您的经纪人在收到创建订阅的请求时生成的跟踪。 (使用:
cat /tmp/contextBroker.log
)。如果您自己启动代理,请在所有跟踪开启的情况下启动它(使用选项:-t 0-255 -logLevel DEBUG
)
最后,很抱歉耽搁了,请假...