2016-02-28 32 views
1

我在同一臺機器上有一個IoTAgent,一個Orion contextBroker,Cygnus和一個MySQL數據庫。Orion contextBroker當數據來自IoTAgent時不會正確通知

當我通過POST直接更新一個值到contextBroker時,它被成功更新並且onchange訂閱引發通知到cygnus,然後該值被持久化到MySQL數據庫。 當我通過POST更新值到IoTAgent時,問題出現了。代理將值正確轉發給contextBroker,並在其mongo數據庫中進行更新。

編輯:

不正確: 「在這種情況下,平變化認購擡高通知 天鵝,但它並不值發送到MySQL數據庫。」

經過一些測試後,我意識到contextBroker不會發送甚至不向Cygnus發起通知。

在任何日誌中沒有重大錯誤。

這是contextBroker日誌通過我的POST接收並updateContext時直接:

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" }) 

編輯:

這些在TCP流捕獲與Wireshark在這兩種情況下。

- 當我直接發送到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: [email protected]) */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: [email protected]) */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: [email protected]) */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: [email protected]) */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 

感謝。

+0

也許可以編輯問題,以便在另一個案例中發送通知消息(例如使用Wireshark捕獲)。 – fgalan

+0

編輯完你的帖子後(謝謝!)我看到在Orion直接更新的情況下Orion發送給Cygnus的通知。但是,在使用IoTAgent的情況下,我無法看到Orion發送給Cygnus的通知(相反,捕獲的流程似乎只是IoTAgent和Orion之間的交互,但這不是我需要與在另一種情況下通知)。 – fgalan

+0

我認爲這正是問題所在。現在我有更多的實體,設備等,並且我意識到使用wireshark捕獲的日誌和數據包仍然具有相同的消息序列。 我不知道爲什麼,但是當updateContext來自IoTAgent時,具有「啓動事務到本地主機:5050/notify」的lmTransactionStart函數不會上升或出現。但是如果我直接更新Orion,它會完全拋出通知。 – cpuigaei

回答

1

驗證Fiware-Service標頭附加請求。

  • 直接給CB不使用這個頭,所以它的值是默認值。參見:srv=<default> | subsrv=/

  • 當通過IoTAgent時,這個頭是Fiware-Service:fiware。請參閱:srv=fiware | subsrv=/

如果我們假設subcription是默認服務,只有第一種情況通知

+0

它可能是有道理的,但只有當CB在'-multiservice'模式下運行。 @cpuigaei,你能編輯你的問題帖子來顯示contextBroker命令行嗎?通常,'ps ax |的輸出grep contextBroker'命令。 – fgalan

+0

與此相關的另一個有用信息添加到問題帖子中將是'echo'show dbs'的輸出。 mongo --quiet'命令在Orion運行的同一臺機器上。 – fgalan

+0

補充信息,謝謝! – cpuigaei

1

通過@佩佩,pepito在his answer描述的行爲纔有意義,在使用-multiservice的情況。但是,您正在運行CB,但未啓用-multiservice ...因此Orion中存在一個錯誤。我們已經分析了這個問題,只有當啓用訂閱緩存時(我們創建了an issue才能使用它)。

因此,總而言之,基本上有兩個解決辦法:

  • 創建IoTAgent用來發送更新(即fiware)在同一服務的預訂。
  • 使用-noCache CLI開關禁用緩存。

編輯:訂閱緩存中的錯誤最近已在開發分支中修復。它將在Orion 1.1.0中提供。

+0

嗨,對不起,延誤。它最終使用-noCache選項禁用緩存。我沒有嘗試另一種解決方案,因爲我不想用CB來進入多服務領域(儘管我知道IoTAgent是強制性的)。感謝大家的幫助! :) – cpuigaei

相關問題