当数据来自IoTAgent时,Orion contextBroker无法正确通知

时间:2016-02-28 14:32:20

标签: fiware fiware-orion fiware-cygnus

我在同一台机器上有IoTAgent,Orion contextBroker,Cygnus和MySQL数据库。

当我通过POST直接将值更新到contextBroker时,它已成功更新,并且onchange订阅会将通知提升到cygnus,然后该值将持久保存到MySQL数据库。 当我通过POST将值更新为IoTAgent时出现问题。代理正确地将值转发给contextBroker,并在其mongo DB中更新。

编辑:

  

不正确:   “在这种情况下,onchange订阅会将通知提升到   cygnus但它不会将值发送到MySQL数据库。“

经过一些测试,我意识到contextBroker不会向Cygnus发送甚至开始通知。

任何日志都没有重大错误。

这是通过我的POST直接接收和updateContext时的contextBroker日志:

    time=2016-02-28T14:42:57.669CET | lvl=INFO | trans=1456501859-068-00000000028 | srv=<default> | subsrv=/ | from=83.50.53.181 | function=collectionUpdate | comp=Orion | msg=connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id.id: "D000", _id.type: "thing", _id.servicePath: /\// }, { $set: { attrs.Temperature0: { value: "10", type: "Number", md: [ { name: "TimeInstant", type: "ISO8601", value: "2016-02-28T13:21:43.156957Z" } ], creDate: 1456351643, modDate: 1456666977 }, modDate: 1456666977 }, $unset: { location: 1 } }>)
time=2016-02-28T14:42:57.670CET | lvl=INFO | trans=1456501859-068-00000000029 | srv=pending | subsrv=pending | from=pending | function=lmTransactionStart | comp=Orion | msg=logMsg.h[1803]: Starting transaction to localhost:5050/notify
time=2016-02-28T14:42:57.670CET | lvl=INFO | trans=1456501859-068-00000000028 | srv=<default> | subsrv=/ | from=83.50.53.181 | function=lmTransactionEnd | comp=Orion | msg=logMsg.h[1887]: Transaction ended
time=2016-02-28T14:42:57.692CET | lvl=INFO | trans=1456501859-068-00000000029 | srv=pending | subsrv=pending | from=pending | function=httpRequestSendWithCurl | comp=Orion | msg=httpRequestSend.cpp[446]: Notification Successfully Sent to localhost:5050/notify
time=2016-02-28T14:42:57.692CET | lvl=INFO | trans=1456501859-068-00000000029 | srv=pending | subsrv=pending | from=pending | function=lmTransactionEnd | comp=Orion | msg=logMsg.h[1887]: Transaction ended
time=2016-02-28T14:43:06.330CET | lvl=INFO | trans=N/A | srv=N/A | subsrv=N/A | from=N/A | function=collectionQuery | comp=Orion | msg=connectionOperations.cpp[79]: Database Operation Successful (query: { conditions.type: "ONCHANGE" })
time=2016-02-28T14:43:06.331CET | lvl=INFO | trans=N/A | srv=N/A | subsrv=N/A | from=N/A | function=collectionUpdate | comp=Orion | msg=connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id: ObjectId('56d2f43a919d4b4fe286b100') }, { $inc: { count: 1 } }>)
time=2016-02-28T14:43:06.332CET | lvl=INFO | trans=N/A | srv=N/A | subsrv=N/A | from=N/A | function=collectionUpdate | comp=Orion | msg=connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id: ObjectId('56d2f43a919d4b4fe286b100'), lastNotification: { $lt: 1456666977 } }, { $set: { lastNotification: 1456666977 } }>)

或通过IoTAgent:

    time=2016-02-28T14:54:11.427CET | lvl=INFO | trans=1456501859-068-00000000030 | srv=fiware | subsrv=/ | from=0.0.0.0 | function=collectionUpdate | comp=Orion | msg=connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id.id: "D000", _id.type: "thing", _id.servicePath: /\// }, { $set: { attrs.Temperature0: { value: "43", type: "Number", md: [ { name: "TimeInstant", type: "ISO8601", value: "2016-02-28T13:54:11.416335Z" } ], creDate: 1456351643, modDate: 1456667651 }, attrs.TimeInstant: { value: "2016-02-28T13:54:11.416335Z", type: "ISO8601", creDate: 1456351372, modDate: 1456667651 }, modDate: 1456667651 }, $unset: { location: 1 } }>)
time=2016-02-28T14:54:11.428CET | lvl=INFO | trans=1456501859-068-00000000030 | srv=fiware | subsrv=/ | from=0.0.0.0 | function=lmTransactionEnd | comp=Orion | msg=logMsg.h[1887]: Transaction ended
time=2016-02-28T14:54:11.428CET | lvl=INFO | trans=1456501859-068-00000000031 | srv=fiware | subsrv=/ | from=0.0.0.0 | function=collectionQuery | comp=Orion | msg=connectionOperations.cpp[79]: Database Operation Successful (query: { _id.id: "D000", _id.type: "thing", _id.servicePath: /^\/$/ })
time=2016-02-28T14:54:11.430CET | lvl=INFO | trans=1456501859-068-00000000031 | srv=fiware | subsrv=/ | from=0.0.0.0 | function=collectionUpdate | comp=Orion | msg=connectionOperations.cpp[401]: Database Operation Successful (update: <{ _id.id: "D000", _id.type: "thing", _id.servicePath: /\// }, { $set: { attrs.Humidity0: { value: "61", type: "Number", md: [ { name: "TimeInstant", type: "ISO8601", value: "2016-02-28T13:54:11.417399Z" } ], creDate: 1456351679, modDate: 1456667651 }, attrs.TimeInstant: { value: "2016-02-28T13:54:11.417399Z", type: "ISO8601", creDate: 1456351372, modDate: 1456667651 }, modDate: 1456667651 }, $unset: { location: 1 } }>)
time=2016-02-28T14:54:11.430CET | lvl=INFO | trans=1456501859-068-00000000031 | srv=fiware | subsrv=/ | from=0.0.0.0 | function=lmTransactionEnd | comp=Orion | msg=logMsg.h[1887]: Transaction ended
time=2016-02-28T14:55:06.349CET | lvl=INFO | trans=N/A | srv=N/A | subsrv=N/A | from=N/A | function=collectionQuery | comp=Orion | msg=connectionOperations.cpp[79]: Database Operation Successful (query: { conditions.type: "ONCHANGE" })

修改

这两种情况下都是使用Wireshark捕获的TCP Streams。

- 当我直接发送到contextBroker时:

##### 158.***.***.27:51112 -> 158.***.***.26:1026 #####
POST /v1/updateContext HTTP/1.1
Host: 158.***.***.26:1026
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Accept: application/json
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/json
Content-Length: 367
Connection: keep-alive

{
"contextElements": [
{
"type": "thing",
"isPattern": "false",
"id": "D000",
"attributes": [
{
"name": "Temperature0",
"type": "Number",
"value": "3"
}
]
}
],
"updateAction": "APPEND"
} 

##### 158.***.***.26:1026 -> 158.***.***.27:51112 #####
HTTP/1.1 200 OK
Content-Length: 398
Content-Type: application/json
Date: Mon, 29 Feb 2016 14:47:45 GMT

{
"contextResponses" : [
{
"contextElement" : {
"type" : "thing",
"isPattern" : "false",
"id" : "D000",
"attributes" : [
{
"name" : "Temperature0",
"type" : "Number",
"value" : ""
}
]
},
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
]
}

##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
l...................orion.entities.........A...._id.id.....D000.._id.type.....thing.._id.servicePath.^\/$...
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
....................................f...._id.5....id.....D000..type.....thing..servicePath...../...attrNames.=....0.....TimeInstant..1.
...Temperature0..2.
...Humidity0...attrs......TimeInstant.X....value.....2016-02-29T12:30:14.140066Z..type.....ISO8601..creDate..(.V.modDate..9.V..Temperature0......value.....2..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-29T12:30:14.140066Z....creDate..).V.modDate.MX.V..Humidity0......value.....41..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-28T14:11:27.896331Z....creDate..).V.modDate....V...creDate..(.V.modDate.MX.V.
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
....................orion.$cmd..............update. ...entities..updates.L....0.D....q.?...._id.id.....D000.._id.type.....thing.._id.servicePath.\/....u......$set......attrs.Temperature0......value.....3..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-29T12:30:14.140066Z....creDate..).V.modDate..Z.V..modDate..Z.V..$unset......location........multi...upsert.....ordered...writeConcern.......
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
G...................................#....ok......nModified......n......
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
K... ...............orion.csubs.........#....conditions.type. ...ONCHANGE..
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
........ ................................_id.V..:..KO.....expiration..'.X.....reference.....http://localhost:5050/notify..throttling..........servicePath...../..entities./....0.'....id.....D000..isPattern.....false....attrs.*....0.
...Temperature0..1.
...Humidity0...conditions.Q....0.I....type. ...ONCHANGE..value.*....0.
...Temperature0..1.
...Humidity0.....expression.6....q.......geometry.......coords.......georel........lastNotification.MX.V.....count..........format.....XML..
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
....!...............orion.$cmd..............update.....csubs..updates.Y....0.Q....q......_id.V..:..KO......u......$inc......count............multi...upsert.....ordered...writeConcern.......
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
G.......!...........................#....ok......nModified......n......
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
...."...............orion.$cmd..............update.....csubs..updates......0......q.:...._id.V..:..KO.....lastNotification......$lt..Z.V.......u.*....$set......lastNotification..Z.V.......multi...upsert.....ordered...writeConcern.......
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
G......."...........................#....ok......nModified......n......

##### ::1:60964 -> ::1:5050 #####
POST /notify HTTP/1.1
User-Agent: orion/0.27.0 libcurl/7.19.7
Host: localhost:5050
Accept: application/xml, application/json
Content-length: 1400
Content-type: application/xml

<notifyContextRequest>
<subscriptionId>56d2f43a919d4b4fe286b100</subscriptionId>
<originator>localhost</originator>
<contextResponseList>
<contextElementResponse>
<contextElement>
<entityId type="thing" isPattern="false">
<id>D000</id>
</entityId>
<contextAttributeList>
<contextAttribute>
<name>Humidity0</name>
<type>Number</type>
<contextValue>41</contextValue>
<metadata>
<contextMetadata>
<name>TimeInstant</name>
<type>ISO8601</type>
<value>2016-02-28T14:11:27.896331Z</value>
</contextMetadata>
</metadata>
</contextAttribute>
<contextAttribute>
<name>Temperature0</name>
<type>Number</type>
<contextValue>3</contextValue>
<metadata>
<contextMetadata>
<name>TimeInstant</name>
<type>ISO8601</type>
<value>2016-02-29T12:30:14.140066Z</value>
</contextMetadata>
</metadata>
</contextAttribute>
</contextAttributeList>
</contextElement>
<statusCode>
<code>200</code>
<reasonPhrase>OK</reasonPhrase>
</statusCode>
</contextElementResponse>
</contextResponseList>
</notifyContextRequest>

##### ::1:5050 -> ::1:60964 #####
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: Jetty(6.1.26)

0


##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
4...
5.1.73.g...o9k4^^<P...................\`K:{#7,t&]$.
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
;...........!.......................root..........1Ln2.=.E..f..
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
...../* mysql-connector-java-5.1.31 ( Revision: alexander.soklakov@oracle.com-20140520065950-groqzzbvxprqdmnz ) */SHOW VARIABLES WHERE Variable_name ='language' OR Variable_name = 'net_write_timeout' OR Variable_name = 'interactive_timeout' OR Variable_name = 'wait_timeout' OR Variable_name = 'character_set_client' OR Variable_name = 'character_set_connection' OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR Variable_name = 'tx_isolation' OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone' OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone' OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
.....9....def. VARIABLES.
Variable_name
VARIABLE_NAME.!...........2....def. VARIABLES..Value.VARIABLE_VALUE.!.................."......character_set_client.utf8.....character_set_connection.utf8.....character_set_results.utf8.....character_set_server.latin1... .init_connect....
.interactive_timeout.28800#....language./usr/share/mysql/english/.....lower_case_table_names.0...
.max_allowed_packet.1048576.....net_buffer_length.16384.....net_write_timeout.60.....query_cache_size.0.....query_cache_type.ON
....sql_mode......system_time_zone.CET.... time_zone.SYSTEM.....tx_isolation.REPEATABLE-READ.....wait_timeout.28800.......".
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
...../* mysql-connector-java-5.1.31 ( Revision: alexander.soklakov@oracle.com-20140520065950-groqzzbvxprqdmnz ) */SELECT @@session.auto_increment_increment
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
.....8....def..."@@session.auto_increment_increment..?.........................1.........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
.....SET NAMES latin1
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
!....SET character_set_results = NULL
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
.....SET autocommit=1
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
#....SET sql_mode='STRICT_TRANS_TABLES'
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
'....create database if not exists `fiware`
##### 127.0.0.1:3306 -> 127.0.0.1:57432 #####
...........
##### 127.0.0.1:57432 -> 127.0.0.1:3306 #####
.....

##### 127.0.0.1:57430 -> 127.0.0.1:3306 #####
.....
##### 127.0.0.1:3306 -> 127.0.0.1:57430 #####
........... 
##### 127.0.0.1:57430 -> 127.0.0.1:3306 #####
.....create table if not exists `ag1_d000_thing` (recvTimeTs long,recvTime text,fiwareservicepath text,entityId text,entityType text,attrName text,attrType text,attrValue text,attrMd text)
##### 127.0.0.1:3306 -> 127.0.0.1:57430 #####
........... 
##### 127.0.0.1:57430 -> 127.0.0.1:3306 #####
.....

##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
4...
5.1.73.h...?W{&HwA{...................j#lu+qz3*w>m.
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
A...........!.......................root.._...'.].s..7.8].....fiware.
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
...../* mysql-connector-java-5.1.31 ( Revision: alexander.soklakov@oracle.com-20140520065950-groqzzbvxprqdmnz ) */SHOW VARIABLES WHERE Variable_name ='language' OR Variable_name = 'net_write_timeout' OR Variable_name = 'interactive_timeout' OR Variable_name = 'wait_timeout' OR Variable_name = 'character_set_client' OR Variable_name = 'character_set_connection' OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR Variable_name = 'tx_isolation' OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone' OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone' OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
.....9....def. VARIABLES.
Variable_name
VARIABLE_NAME.!...........2....def. VARIABLES..Value.VARIABLE_VALUE.!.................."......character_set_client.utf8.....character_set_connection.utf8.....character_set_results.utf8.....character_set_server.latin1... .init_connect....
.interactive_timeout.28800#....language./usr/share/mysql/english/.....lower_case_table_names.0...
.max_allowed_packet.1048576.....net_buffer_length.16384.....net_write_timeout.60.....query_cache_size.0.....query_cache_type.ON
....sql_mode......system_time_zone.CET.... time_zone.SYSTEM.....tx_isolation.REPEATABLE-READ.....wait_timeout.28800.......".
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
...../* mysql-connector-java-5.1.31 ( Revision: alexander.soklakov@oracle.com-20140520065950-groqzzbvxprqdmnz ) */SELECT @@session.auto_increment_increment
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
.....8....def..."@@session.auto_increment_increment..?.........................1.........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
.....SET NAMES latin1
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
!....SET character_set_results = NULL
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
.....SET autocommit=1
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
#....SET sql_mode='STRICT_TRANS_TABLES'
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........
##### 127.0.0.1:57433 -> 127.0.0.1:3306 #####
.....insert into `ag1_d000_thing` (recvTimeTs,recvTime,fiwareservicepath,entityId,entityType,attrName,attrType,attrValue,attrMd) values ('1456757265708','2016-02-29T14:47:45.708Z','ag1','D000','thing','Humidity0','Number','41','[{"name":"TimeInstant","type":"ISO8601","value":"2016-02-28T14:11:27.896331Z"}]'),('1456757265708','2016-02-29T14:47:45.708Z','ag1','D000','thing','Temperature0','Number','3','[{"name":"TimeInstant","type":"ISO8601","value":"2016-02-29T12:30:14.140066Z"}]')
##### 127.0.0.1:3306 -> 127.0.0.1:57433 #####
...........&Records: 2 Duplicates: 0 Warnings: 0

- 当我通过IoTAgent发送路过时:

##### 158.***.***.27:51203 -> 158.***.***.26:8080 #####
POST /iot/d?i=D000&k=ak0 HTTP/1.1
Host: 158.***.***.26:8080
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Fiware-Service: fiware
Fiware-ServicePath: /
Content-Type: application/json
Content-Length: 4
Connection: keep-alive

t0|4

##### 158.***.***.26:8080 -> 158.***.***.27:51203 #####
HTTP/1.1 200 OK
Connection: close
Host: 158.***.***.26:8080
Content-Length: 0

##### 127.0.0.1:40831 -> 127.0.0.1:27017 #####
`...t...............iot.SERVICE.........*....apikey.....ak0..resource...../iot/d......._id......
##### 127.0.0.1:27017 -> 127.0.0.1:40831 #####
....'...t...........................s....apikey.....ak0..token.....tk0..entity_type.......resource...../iot/d..service.....fiware..service_path...../..
##### 127.0.0.1:40823 -> 127.0.0.1:27017 #####
v...u...............iot.DEVICE.........A....device_id.....D000..service.....fiware..service_path...../......._id......
##### 127.0.0.1:27017 -> 127.0.0.1:40823 #####
A...(...u................................device_id.....D000..entity_name.....D000..entity_type.......protocol.....PDI-IoTA-UltraLight..attributes......0.?....object_id.....t0..name.
...Temperature0..type.....Number...1.<....object_id.....h0..name.
...Humidity0..type.....Number....service.....fiware..service_path...../..

##### ::1:34494 -> ::1:1026 #####
POST /v1/updateContext HTTP/1.1
X-Auth-Token: tk0
Fiware-ServicePath: /
Connection: close
Fiware-Service: fiware
Host: localhost:1026
Content-Length: 331
Accept: application/json
Content-Type: application/json

{"updateAction":"APPEND","contextElements":[{"id":"D000","type":"thing","isPattern":"false","attributes":[{"name":"Temperature0","type":"Number","value":"4","metadatas":[{"name":"TimeInstant","type":"ISO8601","value":"2016-02-29T14:57:34.858881Z"}]},{"name":"TimeInstant","type":"ISO8601","value":"2016-02-29T14:57:34.858881Z"}]}]}
##### ::1:1026 -> ::1:34494 #####
HTTP/1.1 200 OK
Connection: close
Content-Length: 723
Content-Type: application/json
Date: Mon, 29 Feb 2016 14:57:34 GMT

{
"contextResponses" : [
{
"contextElement" : {
"type" : "thing",
"isPattern" : "false",
"id" : "D000",
"attributes" : [
{
"name" : "Temperature0",
"type" : "Number",
"value" : "",
"metadatas" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-02-29T14:57:34.858881Z"
}
]
},
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : ""
}
]
},
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
]
}

##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
l...,...............orion.entities.........A...._id.id.....D000.._id.type.....thing.._id.servicePath.^\/$...
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
....)...,...........................f...._id.5....id.....D000..type.....thing..servicePath...../...attrNames.=....0.....TimeInstant..1.
...Temperature0..2.
...Humidity0...attrs......TimeInstant.X....value.....2016-02-29T12:30:14.140066Z..type.....ISO8601..creDate..(.V.modDate..9.V..Temperature0......value.....3..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-29T12:30:14.140066Z....creDate..).V.modDate..Z.V..Humidity0......value.....41..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-28T14:11:27.896331Z....creDate..).V.modDate....V...creDate..(.V.modDate..Z.V. ##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
....-...............orion.$cmd..............update. ...entities..updates......0......q.?...._id.id.....D000.._id.type.....thing.._id.servicePath.\/....u.T....$set......attrs.Temperature0......value.....4..type.....Number..md.\....0.T....name.....TimeInstant..type.....ISO8601..value.....2016-02-29T14:57:34.858881Z....creDate..).V.modDate.^\.V..attrs.TimeInstant.X....value.....2016-02-29T14:57:34.858881Z..type.....ISO8601..creDate..(.V.modDate.^\.V..modDate.^\.V..$unset......location........multi...upsert.....ordered...writeConcern.......
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
G...*...-...........................#....ok......nModified......n......
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
K...................orion.csubs.........#....conditions.type. ...ONCHANGE..
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
....+...................................._id.V..:..KO.....expiration..'.X.....reference.....http://localhost:5050/notify..throttling..........servicePath...../..entities./....0.'....id.....D000..isPattern.....false....attrs.*....0.
...Temperature0..1.
...Humidity0...conditions.Q....0.I....type. ...ONCHANGE..value.*....0.
...Temperature0..1.
...Humidity0.....expression.6....q.......geometry.......coords.......georel........lastNotification..Z.V.....count..........format.....XML..
##### 127.0.0.1:40671 -> 127.0.0.1:27017 #####
K.../...............orion.csubs.........#....conditions.type. ...ONCHANGE..
##### 127.0.0.1:27017 -> 127.0.0.1:40671 #####
....,.../................................_id.V..:..KO.....expiration..'.X.....reference.....http://localhost:5050/notify..throttling..........servicePath...../..entities./....0.'....id.....D000..isPattern.....false....attrs.*....0.
...Temperature0..1.
...Humidity0...conditions.Q....0.I....type. ...ONCHANGE..value.*....0.
...Temperature0..1.
...Humidity0.....expression.6....q.......geometry.......coords.......georel........lastNotification..Z.V.....count..........format.....XML..

编辑:

这是订阅信息:

    {
    "id": "56d2f43a919d4b4fe286b100",
    "expires": "2017-02-27T13:20:58.00Z",
    "status": "active",
    "subject": {
        "entities": [{
            "id": "D000",
            "idPattern": "",
            "type": ""
        }],
        "condition": {
            "attributes": ["Temperature0", "Humidity0"],
            "expression": {
                "q": "",
                "geometry": "",
                "coords": "",
                "georel": ""
            }
        }
    },
    "notification": {
        "callback": "http://localhost:5050/notify",
        "throttling": 1,
        "timesSent": 8,
        "lastNotification": "2016-03-04T18:28:46.00Z",
        "attributes": ["Temperature0", "Humidity0"]
    }
}

编辑:

另一个有用的信息:

# ps aux | grep contextBroker
orion     2310  0.0  0.1 444700  5488 ?        Ssl  Mar10   0:03 /usr/bin/contextBroker -port 1026 -logDir /var/log/contextBroker -pidpath /var/run/contextBroker/contextBroker.pid -dbhost localhost -db orion -logLevel INFO
root     20648  0.0  0.0 103328   896 pts/0    S+   13:27   0:00 grep contextBroker

# echo 'show dbs' | mongo --quiet
iot    0.000GB
local  0.000GB
orion  0.000GB

感谢。

2 个答案:

答案 0 :(得分:1)

在附加请求中验证 Fiware-Service 标头。

    直接到CB的
  • 不使用此标头,因此其默认值为。请参阅:Title = classFactory render: -> div className: "title page", h2 className: "h2header ui header block", Icon {} Icon = classFactory render: -> i className: "icon user"

  • 当通过IoTAgent时,此标头是Fiware-Service:fiware。请参阅:srv=<default> | subsrv=/

如果我们假设订阅是默认服务,则仅通知第一种情况

答案 1 :(得分:1)

@ pepe-pepito在his answer中描述的行为仅在使用-multiservice的情况下才有意义。但是,您运行的CB未启用-multiservice ...因此Orion中存在错误。我们已经解决了这个问题,只有在启用了订阅缓存时才会发生这种情况(我们创建了an issue并使用它)。

因此,总而言之,基本上有两种解决方案:

  • 在IoTAgent用于发送更新的同一服务中创建订阅(即fiware)。
  • 使用-noCache CLI开关禁用缓存。

编辑:订阅缓存中的错误最近已在开发分支中修复。它将在Orion 1.1.0中提供。