[英]Orion Context Broker - Query by location with no elements
我正在使用Orion Context Broker的0.25.0版本。
如果我只使用上下文實體加載上下文代理,並且我將實體搜索到特定區域,那么一切似乎都可以正常工作:
(curl localhost:1026/v1/queryContext?limit=100 -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
"entities":[
{
"type":"Dispositivo_tmp",
"isPattern":"true",
"id":".*"
}
],
"restriction": {
"scopes": [
{
"type": "FIWARE::Location",
"value": {
"circle": {
"centerLatitude": "43.322361",
"centerLongitude": "-1.983222",
"radius": "1500"
}
}
}
]
}
}
EOF
我得到了位於該區域的上下文實體的響應:
...
{
"contextElement": {
"attributes": [
{
"metadatas": [
{
"name": "location",
"type": "string",
"value": "WGS84"
}
],
"name": "position",
"type": "coords",
"value": "43.3221, -1.9831"
},
{
"name": "pressure",
"type": "integer",
"value": "1"
},
{
"name": "temperature",
"type": "float",
"value": "25"
}
],
"id": "CE_5.1",
"isPattern": "false",
"type": "Dispositivo_tmp"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
如果定義區域中沒有元素,我會得到預期的響應:
{
"errorCode": {
"code": "404",
"reasonPhrase": "No context element found"
}
}
如果我也使用上下文注冊加載上下文代理,則會出現問題。 如果我在上下文代理上同時擁有上下文實體和上下文注冊,並且我將上下文實體檢查到我知道的區域是空的,我將不會得到任何響應,或者我會得到這個:
{
"errorCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
似乎上下文代理中加載的上下文注冊量越大,從系統獲得(負)響應的時間就越長。
在同一場景中,如果我在具有元素的區域中查找上下文實體,則沒有問題。 在這種情況下,我會得到正確的答復。
這有什么意義嗎?
謝謝
我已經看到這種行為是由於我在創建上下文注冊時定義的URL。
網址不正確。 因此,當上下文代理嘗試使用提供的URL與設備聯系時,它開始等待不會到達的答案。
我修改了URL並使用了'accumulate-server.py'虛擬測試服務器:
http://localhost:1028/accumulate
使用它,上下文代理獲得一個中間響應並繼續執行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.