FIWARE-Orion上下文代理-无法创建订阅-缺少回调
我正在使用Orion上下文代理,我正在尝试添加一个新的订阅,但是我得到一个错误,即尽管我已经提供了一个回调,但是回调丢失了 这里是我拥有的实体FIWARE-Orion上下文代理-无法创建订阅-缺少回调,fiware,fiware-orion,Fiware,Fiware Orion,我正在使用Orion上下文代理,我正在尝试添加一个新的订阅,但是我得到一个错误,即尽管我已经提供了一个回调,但是回调丢失了 这里是我拥有的实体 $ curl localhost:1026/v2/entities -s -S --header 'Accept: application/json' | python -mjson.tool [ { "id": "Room1", "pressure": { "metadata": {},
$ 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"}
$curl-v localhost:1026/v2/subscriptions-s-s——标题“内容类型:application/json”\
>-d@-“说明”:“订阅以获取有关Room1的信息”,
>“主题”:{
>“实体”:[
> {
>“id”:“Room1”,
>“类型”:“房间”
> }
> ],
>“条件”:{
>“属性”:[“温度”]
> }
> },
>“通知”:{
>“http”:{
>“url”:”http://localhost:1028/accumulate"
> },
>“属性”:[
>“温度”,
>“压力”
> ]
> },
>“到期”:“2040-01-01T14:00:00.00Z”,
>“节流”:5
> }
>EOF
*在DNS缓存中找不到主机名
*正在尝试127.0.0.1。。。
*已连接到本地主机(127.0.0.1)端口1026(#0)
>POST/v2/subscriptions HTTP/1.1
>用户代理:curl/7.35.0
>主机:localhost:1026
>接受:*/*
>内容类型:application/json
>内容长度:417
>
*上传已完全发送:417字节中有417个
首先,创建实体的请求(POST/v2/entities)不接受实体向量,而是接受一个对象。该请求应该会给出一个错误(不幸的是,代理响应的JSON解析错误不是100%正确)。将请求更改为仅创建Room1,如果还想创建Room2,请添加另一个请求。现在,订阅的创建看起来不错。我按照您的确切要求进行了测试,结果很好。
现在,为了理解您的问题,我请您在问题描述中添加一些信息:
- 您正在使用的Orion上下文代理的哪个版本?(使用:
)-您可能需要更新到新版本,以防版本太旧(1.2.0是最新版本)李>curl localhost:1026/version
- 代理在接收创建订阅的请求时生成的跟踪。(使用:
)。如果您自己启动代理,请在启用所有跟踪的情况下启动它(使用选项:cat/tmp/contextBroker.log
)-t0-255-logleveldebug
最后,很抱歉延迟,休假时间…v2/entities请求是GET而不是POST,它们是我已经创建的条目,正在从系统返回
0.28.0-next
是版本号。已更新为版本1.2.0
,问题现已解决。谢谢你的帮助。啊,这是一个。。。好吧,我错了,我误解了。很高兴新版本的代理解决了这个问题:-)