私のローカルホストでubuntu 15.10 64ビットのドッキングバージョンである、Fiware-Orion ContextBroker 0.28を使用しています。サブスクリプションがドッキングされたfi-orionを使用して動作していないようです
$ curl localhost:1026/version
{
"orion" : {
"version" : "0.28.0-next",
"uptime" : "0 d, 0 h, 0 m, 6 s",
"git_hash" : "067e13618c247daa4af61f82d7831f3015d9eb5d",
"compile_time" : "Mon Mar 14 13:04:02 UTC 2016",
"compiled_by" : "root",
"compiled_in" : "838a42ae8431"
}
}
私が使用しているドッキングウィンドウ構成は次のとおりです。
$ cat docker-compose.yml
mongo:
image: mongo:2.6
command: --smallfiles --nojournal
orion:
image: fiware/orion
links:
- mongo
ports:
- "1026:1026"
command: -dbhost mongo
私はサブスクリプションを行うとき、私はオリオン/ドッキングウィンドウから取得する警告がある:私は
orion_1 | [email protected]:19:14 AlarmManager.cpp[303]: Raising alarm NotificationError localhost:1028/accumulate: (curl_easy_perform failed: Couldn't connect to server)
次てりますAPI V1 walkthorughは変更のサブスクリプションをテストします。私はmongodbと新しいdockerized(sudo docker-compose upとすべてのfuzz)のfiware-orion 0.28から始めます。
$ (curl localhost:1026/v1/queryContext -s -S --header 'Content-Type: application/json' \
> --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
> {
> "entities": [
> {
> "type": "Room",
> "isPattern": "false",
> "id": "Room1"
> }
> ]
> }
> EOF
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "pressure",
"type": "integer",
"value": "720"
},
{
"name": "temperature",
"type": "float",
"value": "23"
}
],
"id": "Room1",
"isPattern": "false",
"type": "Room"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
その後、私は、サブスクリプション
$ (curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' \
> --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
> {
> "entities": [
> {
> "type": "Room",
> "isPattern": "false",
> "id": "Room1"
> }
> ],
> "attributes": [
> "pressure"
> ],
> "reference": "http://localhost:1028/accumulate",
> "duration": "P1M",
> "notifyConditions": [
> {
> "type": "ONCHANGE",
> "condValues": [
> "pressure"
> ]
> }
> ],
> "throttling": "PT5S"
> }
> EOF
{
"subscribeResponse": {
"duration": "P1M",
"subscriptionId": "570f8ac247fcf8a62722353c",
"throttling": "PT5S"
}
}
の操作を行います。それから私は、アキュムレータ
$ ./accumulator-server.py 1028 /accumulate localhost on
verbose mode is on
* Running on http://localhost:1028/ (Press CTRL+C to quit)
は、その後、私はROOM1
$ (curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' \
> --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
> {
> "contextElements": [
> {
> "type": "Room",
> "isPattern": "false",
> "id": "Room1",
> "attributes": [
> {
> "name": "temperature",
> "type": "float",
> "value": "23"
> },
> {
> "name": "pressure",
> "type": "integer",
> "value": "720"
> }
> ]
> }
> ],
> "updateAction": "APPEND"
> }
> EOF
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "temperature",
"type": "float",
"value": ""
},
{
"name": "pressure",
"type": "integer",
"value": ""
}
],
"id": "Room1",
"isPattern": "false",
"type": "Room"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
を登録その後、私はちょうどチェックするために、クエリコンテキストをテスト開始します
この時点で、男性アキュムレータは最初のアップデートを受け取るかもしれないが、それは必須ではないので、私は何も受け取っていませんが、おそらくそれは問題ありません。またはそうでないかもしれない、サブスクリプションのクエリを送信した後、オリオンのドッキングウィンドウが言うので:
orion_1 | [email protected]:19:14 AlarmManager.cpp[303]: Raising alarm NotificationError localhost:1028/accumulate: (curl_easy_perform failed: Couldn't connect to server)
最後に、私は、エンティティを更新し、私はアキュムレータに更新を受ける必要がありますが、私はしません。
$ (curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' \
> --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
> {
> "contextElements": [
> {
> "type": "Room",
> "isPattern": "false",
> "id": "Room1",
> "attributes": [
> {
> "name": "temperature",
> "type": "float",
> "value": "56.5"
> },
> {
> "name": "pressure",
> "type": "integer",
> "value": "553"
> }
> ]
> }
> ],
> "updateAction": "UPDATE"
> }
> EOF
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "temperature",
"type": "float",
"value": ""
},
{
"name": "pressure",
"type": "integer",
"value": ""
}
],
"id": "Room1",
"isPattern": "false",
"type": "Room"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
私はまた、Ubuntuでコンパイルするためにfi-orionをコンパイルすることは非常に難しいと言います。それが私がドッカーを使用している理由です。
コンパイルOrionはCentOSでのみサポートされていますが、わずかな変更でUbuntuで実行するのはあまり難しくありません。 – LeandroGuillen