猎户座 - 模式订阅以发送多个更新

时间:2015-11-13 10:34:33

标签: fiware fiware-orion

当对象发生更改时,我使用Orion将更新发送到Proton-CEP。

但是,我每隔几秒就会发生很多此类对象更新。所以我将这些更新分批发送给Orion,如下所示:

{
    "contextElements": [
        {
            "type": "Queue",
            "isPattern": "false",
            "id": "Queue.routes_queue",
            "attributes": [
                {
                    "name": "volume",
                    "type": "integer",
                    "value": "3"
                }
            ]
        }, 
        {
            "type": "Queue",
            "isPattern": "false",
            "id": "Queue.optimizer_queue",
            "attributes": [
                {
                    "name": "volume",
                    "type": "integer",
                    "value": "4"
                }
            ]
        }
    ],
    "updateAction": "APPEND"
}

我有一个订阅,它应该将这些事件(当卷已经更改时)发送给CEP进行处理。

{
    "entities": [
        {
            "type": "Queue",
            "isPattern": "true",
            "id": "Queue.*"
        }
    ],
    "attributes": [
        "volume"
    ],
    "reference": "http://<cep-host>:8080/ProtonOnWebServer/rest/events",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "volume"
            ]
        }
    ],
    "throttling": "PT1S"
}

CEP配置为侦听这些事件,并将它们写入文件。不幸的是,只写了第一个元素。

我已经通过使用提供的accumulator-server脚本确认这不是CEP问题。我只能看到一个暴露的更新:

POST http://localhost:1028/accumulate
Content-Length: 741
User-Agent: orion/0.24.0 libcurl/7.19.7
Host: localhost:1028
Accept: application/xml, application/json
Content-Type: application/xml

<notifyContextRequest>
  <subscriptionId>5645bb21abde60e23096acef</subscriptionId>
  <originator>localhost</originator>
  <contextResponseList>
    <contextElementResponse>
      <contextElement>
        <entityId type="Queue" isPattern="false">
          <id>Queue.routes_queue</id>
        </entityId>
        <contextAttributeList>
          <contextAttribute>
            <name>volume</name>
            <type>integer</type>
            <contextValue>4</contextValue>
          </contextAttribute>
        </contextAttributeList>
      </contextElement>
      <statusCode>
        <code>200</code>
        <reasonPhrase>OK</reasonPhrase>
      </statusCode>
    </contextElementResponse>
  </contextResponseList>
</notifyContextRequest>
=======================================

::1 - - [13/Nov/2015 10:29:05] "POST /accumulate HTTP/1.1" 200 -

Orion可以为所有已更改的元素发送更新吗?

1 个答案:

答案 0 :(得分:1)

解决方案就是去除节流。限制适用于整个订阅,而不仅仅适用于匹配模式中的单个对象。