Context Broker仅在被问到两次时才响应

时间:2015-10-01 10:18:29

标签: fiware fiware-orion

所以问题是,当我尝试与Context Broker建立连接时,我是否正在尝试更新实体或读取值。它只在我第二次询问时才响应。

Context Broker版本:0.24.0(我从0.20.0更新,因为我认为这是问题)

示例:

python2.7 GetEntity.py entity_1

输出:

* Asking to http://188.***.**.***:1026/ngsi10/queryContext
* Headers: {'Fiware-Service': 'fiwarefinal', 'content-type': 'application/json', 'accept': 'application/json', 'X-Auth-Token': 'NULL'}
* Sending PAYLOAD:
{
    "entities": [
        {
            "type": "",
            "id": "entity_1",
            "isPattern": "false"
        }
    ],
    "attributes": []
}

...
Traceback (most recent call last):
  File "GetEntity.py", line 73, in <module>
    r = requests.post(URL, data=PAYLOAD, headers=HEADERS)
  File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 109, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))

当我第二次这样做时:

* Asking to http://188.***.**.***:1026/ngsi10/queryContext
* Headers: {'Fiware-Service': 'fiwarefinal', 'content-type': 'application/json', 'accept': 'application/json', 'X-Auth-Token': 'NULL'}
* Sending PAYLOAD:
{
    "entities": [
        {
            "type": "",
            "id": "entity_1",
            "isPattern": "false"
        }
    ],
    "attributes": []
}

...

* Status Code: 200
* Response:
{
  "contextResponses" : [
    {
      "contextElement" : {
        "type" : "",
        "isPattern" : "false",
        "id" : "entity_1",
        "attributes" : [
          {
            "name" : "humidity",
            "type" : "int",
            "value" : "4"
          },
          {
            "name" : "latitude",
            "type" : "float",
            "value" : "3"
          },
          {
            "name" : "longitude",
            "type" : "float",
            "value" : "5"
          },
          {
            "name" : "temperature",
            "type" : "int",
            "value" : "8"
          }
        ]
      },
      "statusCode" : {
        "code" : "200",
        "reasonPhrase" : "OK"
      }
    }
  ]
}

示例Nrº2:

curl http://188.***.**.***:1026/version

输出:

curl: (56) Failure when receiving data from the peer

当我第二次这样做时:

<orion>
  <version>0.24.0</version>
  <uptime>0 d, 0 h, 41 m, 27 s</uptime>
  <git_hash><deleted for safety reasons></git_hash>
  <compile_time>Mon Sep 14 17:52:44 CEST 2015</compile_time>
  <compiled_by>fermin</compiled_by>
  <compiled_in>centollo</compiled_in>
</orion>

有时我甚至不得不重启,因为当我检查Context Broker的状态时,它会给我一个错误。我不确定错误,但我认为它类似于“pid文件不存在”

修改

Error COntext Broker

编辑2:

所以我尝试使用Fiware-Figway的脚本:

python2.7 GetEntity.py entity_1

正如预期的那样,由于这个问题,它的工作时间只有一半。

Context Broker的完整日志跟踪:

time=2015-10-01T11:31:09.269EDT | lvl=INFO | trans=N/A | function=main | comp=Orion | msg=contextBroker.cpp[1509]: Orion Context Broker is running
time=2015-10-01T11:31:09.280EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.280EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.281EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.282EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.282EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.283EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.283EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.284EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.284EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.285EDT | lvl=INFO | trans=N/A | function=mongoConnect | comp=Orion | msg=mongoConnectionPool.cpp[196]: Successful connection to database
time=2015-10-01T11:31:09.285EDT | lvl=INFO | trans=N/A | function=mongoInit | comp=Orion | msg=contextBroker.cpp[1289]: Connected to mongo at localhost:orion
time=2015-10-01T11:31:09.286EDT | lvl=INFO | trans=N/A | function=getOrionDatabases | comp=Orion | msg=MongoGlobal.cpp[283]: Database Operation Successful (listDatabases command)
time=2015-10-01T11:31:09.286EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:09.287EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:09.288EDT | lvl=INFO | trans=N/A | function=treatOnTimeIntervalSubscriptions | comp=Orion | msg=MongoGlobal.cpp[553]: Database Operation Successful ({ conditions.type: "ONTIMEINTERVAL" })
time=2015-10-01T11:31:09.288EDT | lvl=INFO | trans=N/A | function=main | comp=Orion | msg=contextBroker.cpp[1597]: Startup completed
time=2015-10-01T11:31:18.112EDT | lvl=INFO | trans=1443713469-276-00000000001 | function=connectionTreat | comp=Orion | msg=rest.cpp[910]: Starting transaction from 127.0.0.1:45867/version
time=2015-10-01T11:31:18.114EDT | lvl=INFO | trans=1443713469-276-00000000001 | function=requestCompleted | comp=Orion | msg=rest.cpp[442]: Transaction ended
time=2015-10-01T11:31:19.289EDT | lvl=INFO | trans=N/A | function=getOrionDatabases | comp=Orion | msg=MongoGlobal.cpp[283]: Database Operation Successful (listDatabases command)
time=2015-10-01T11:31:19.290EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:19.290EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:29.292EDT | lvl=INFO | trans=N/A | function=getOrionDatabases | comp=Orion | msg=MongoGlobal.cpp[283]: Database Operation Successful (listDatabases command)
time=2015-10-01T11:31:29.293EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:29.293EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:39.294EDT | lvl=INFO | trans=N/A | function=getOrionDatabases | comp=Orion | msg=MongoGlobal.cpp[283]: Database Operation Successful (listDatabases command)
time=2015-10-01T11:31:39.295EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:39.295EDT | lvl=INFO | trans=N/A | function=subscriptionsTreat | comp=Orion | msg=MongoGlobal.cpp[2911]: Database Operation Successful ({})
time=2015-10-01T11:31:39.427EDT | lvl=INFO | trans=1443713469-276-00000000002 | function=connectionTreat | comp=Orion | msg=rest.cpp[910]: Starting transaction from 188.***.**.***:58440/ngsi10/queryContext
time=2015-10-01T11:31:39.442EDT | lvl=INFO | trans=1443713469-276-00000000002 | function=entitiesQuery | comp=Orion | msg=MongoGlobal.cpp[1616]: Database Operation Successful ({ query: { $or: [ { _id.id: "entity_1" } ], _id.servicePath: { $in: [ null, /^$/, /^/.*/ ] } }, orderby: { creDate: 1 } })
time=2015-10-01T11:31:39.444EDT | lvl=INFO | trans=1443713469-276-00000000002 | function=registrationsQuery | comp=Orion | msg=MongoGlobal.cpp[2206]: Database Operation Successful ({ query: { $or: [ { contextRegistration.entities: { $in: [] } }, { contextRegistration.entities.id: { $in: [ "entity_1" ] } } ], expiration: { $gt: 1443713499 }, servicePath: { $in: [ null, /^$/, /^/.*/ ] } }, orderby: { _id: 1 } })
time=2015-10-01T11:31:39.453EDT | lvl=INFO | trans=1443713469-276-00000000002 | function=requestCompleted | comp=Orion | msg=rest.cpp[442]: Transaction ended

0 个答案:

没有答案