NGSI Subscription

このカスタム・ノードは、NGSIv2 サブスクリプションを作成、更新、または削除できるノードです。

サブスクリプションの作成

新しいサブスクリプションを作成できます。

プロパティ

  • name: ノード・インスタンスの名前
  • Context Broker: Context Broker のエンドポイント
  • ServicePath: FIWARE Service Path
  • Action type: create
  • Entity type: 通知の対象となるエンティティのタイプ
  • ID pattern: 通知の対象となるエンティティの id パターン
  • Watched Attrs: 通知をトリガーする属性名のリスト
  • Query: ; で区切られたステートメントのリストで構成されるクエリ式
  • Notification Endpoint: 通知先の URL
  • Attrs: 通知メッセージに含まれる属性のリスト
  • Attrs format: エンティティが通知でどのように表現されるかを指定します

入力

payload JSON Object

msg.payload には NGSIv2 サブスクリプション・データを含める必要があります。

{
  "type": "T",
  "idPattern": ".*",
  "watchedAttrs": "temperature,humidity",
  "q": "temperature>10",
  "url": "http://context-consumer",
  "attrs": "humidity",
  "description": "subscription for node-red",
  "expires": "2030-04-05T14:00:00.00Z",
  "throttling": 5
}
{
  "description": "subscription for node-red",
  "notification": {
    "attrs": [
      "humidity"
    ],
    "http": {
      "url": "http://context-consumer"
    }
  },
  "subject": {
    "condition": {
      "attrs": [
        "temperature",
        "humidity"
      ],
      "expression": {
        "q": "temperature>10"
      }
    },
    "entities": [
      {
        "idPattern": ".*",
        "type": "T"
      }
    ]
  },
  "expires": "2030-04-05T14:00:00.00Z",
  "throttling": 5
}

出力

payload String

msg.payload には、サブスクリプション id が含まれます。

5fa7988a627088ba9b91b1c1

statusCode Number

A msg.statusCode contains a status code.

201

サブスクリプションの更新

既存のサブスクリプションを更新できます。

プロパティ

  • name: ノード・インスタンスの名前
  • Context Broker: Context Broker のエンドポイント
  • ServicePath: FIWARE Service Path
  • Action type: update
  • Entity type: 通知の対象となるエンティティのタイプ
  • ID pattern: 通知の対象となるエンティティの id パターン
  • Watched Attrs: 通知をトリガーする属性名のリスト
  • Query: ; で区切られたステートメントのリストで構成されるクエリ式
  • Notification Endpoint: 通知先の URL
  • Attrs: 通知メッセージに含まれる属性のリスト
  • Attrs format: エンティティが通知でどのように表現されるかを指定します

入力

payload JSON Object

msg.payload には、サブスクリプション id と NGSIv2 サブスクリプション・フラグメントを含める必要があります。

{
  "id": "5fa7988a627088ba9b91b1c1",
  "expires": "2030-04-05T14:00:00.00Z"
}

出力

statusCode Number

msg.statusCode にはステータス・コードが含まれています。

204

サブスクリプションの削除

既存のサブスクリプションを削除できます。

プロパティ

  • name: ノード・インスタンスの名前
  • Context Broker: Context Broker のエンドポイント
  • ServicePath: FIWARE Service Path
  • Action type: delete

入力

payload string

msg.payload には、サブスクリプション id を含める必要があります。

5fa7988a627088ba9b91b1c1

出力

statusCode Number

msg.statusCode にはステータス・コードが含まれています。

204

Payload 内の actionType の値を使用

サブスクリプションを作成、更新、または削除できます。

プロパティ

  • name: ノード・インスタンスの名前
  • Context Broker: Context Broker のエンドポイント
  • ServicePath: FIWARE Service Path
  • Action type: value of actionType in payload

入力 (create)

payload JSON Object

新しいサブスクリプションを作成するとき、 msg.payload には actionType とサブスクリプション・データを含む JSON オブジェクトが含まれている必要があります。

{
  "actionType": "create",
  "subscription": {
    "type": "T",
    "idPattern": ".*",
    "watchedAttrs": "temperature,humidity",
    "q": "temperature>10",
    "url": "http://context-consumer",
    "attrs": "humidity",
    "description": "subscription for node-red",
    "expires": "2030-04-05T14:00:00.00Z",
    "throttling": 5
  }
}

出力 (create)

payload string

msg.payload には、サブスクリプション id が含まれます。

5fa7988a627088ba9b91b1c1

statusCode Number

A msg.statusCode contains a status code.

201

入力 (update)

payload JSON Object

既存のサブスクリプションを更新する場合、 msg.payload には、actionType、サブスクリプション id、およびサブスクリプション・データを含む JSON オブジェクトが含まれている必要があります。

{
  "actionType": "update",
  "id": "63ea11e4a0cec98fc6017aae",
  "subscription": {
    "expires": "2030-04-05T14:00:00.00Z"
  }
}

出力 (update)

statusCode Number

msg.statusCode にはステータス・コードが含まれています。

204

入力 (delete)

payload JSON Object

既存のサブスクリプションを削除する場合、msg.payload には、actionType とサブスクリプション id を持つ JSON オブジェクトが含まれている必要があります。

{
  "actionType": "delete",
  "id": "63ea11e4a0cec98fc6017aae"
}

出力 (delete)

statusCode Number

msg.statusCode にはステータス・コードが含まれています。

204