簡體   English   中英

Orion Context Broker Fiware中訂閱的屬性參考

[英]Attribute Reference for subscription in Orion Context Broker Fiware

我需要在引用屬性中添加什么?

我使用兩種形式,這兩種形式對Orion Context Broker都是不利的:

URL url = new URL("http://130.206.127.23:1026/ngsi10/notifyContext");
//String url = "http://localhost:1028/accumulate";
cabecera.put("reference", ""+url);

使用此代碼,我將為reference屬性生成下一個JSON String

...."reference":"http:\/\/130.206.127.23:1026\/ngsi10\/notifyContext",...

這是OCB的回應

<subscribeContextResponse>
  <subscribeError>
    <errorCode>
      <code>400</code>
      <reasonPhrase>Bad Request</reasonPhrase>
      <details>JSON Parse Error: <unspecified file>(1): invalid escape sequence</details>
    </errorCode>
  </subscribeError>
</subscribeContextResponse>

也與此參數有關,我是否需要服務器中正在執行的程序來接收有關我的訂閱的信息?
我可以從Orion Context Broker資源中獲取程序來執行此任務嗎?

以下是我調用服務的JSON,但是我不確定reference屬性。 我想向我的Orion Context Broker實例發送訂閱。 我正在發送此JSON:

{
  "duration": "P1M",
  "reference": "http://130.206.127.23:1026/ngsi10/notifyContext",
  "notifyConditions": [
    {
      "condValues": [
        "PT10s"
      ],
      "type": "ONTIMEINTERVAL"
    }
  ],
  "entities": [
    {
      "id": "1.0",
      "type": "Capsule",
      "isPattern": "false"
    }
  ],
  "attributes": [
    "temperature"
  ]
}

提前致謝。

參考元素在Orion用戶手冊中進行描述:

發送通知的回調URL是使用reference元素定義的。

因此,如您的示例所示,如果您的引用是http://130.206.127.23:1026/ngsi10/notifyContext ,則您應該在主機130.206.127.23端口1026上偵聽REST服務器,以便能夠在/ngsi10/notifyContext接收通知路徑。 請注意,您的CB(我的意思是,您要向其發送subscriptionContext請求的CB)是發送通知的參與者,而不是接收通知的參與者,因此它不得運行在130.206.127.23:1026。

您可以使用所需的任何編程語言來實現Notifications Receiver程序(只要它實現了所需的REST服務器接口)。 您可以看一下accumulator-server.py ,這是用Python實現的“虛擬”通知接收器示例,用於測試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM