Search code examples
fiwarefiware-orion

Context Broker, ONTIMEINTERVAL subscribe immediatelly sends request to reference


The problem is even if I put condValues to PT10S, when I send request to contextBroker it requests back the reference url rigth away, not after 10 sec, and then it continues to send requests at 10 sec. My question: is there a way to avoid the first initial request?

Here is a body of the request that I send to server where contextBroker is installed.

{
    "entities": [{
        "type": "Cycle",
        "isPattern": "false",
        "id": "someid"
    }],
    "attributes": [
        ...
    ],
    "reference": "someurl"
    "duration": "P1M",
    "notifyConditions": [{
        "type": "ONTIMEINTERVAL",
        "condValues": [
            "PT10S"
        ]
    }]
}

Solution

  • At the present moment (Orion 1.1) initial notification cannot be avoided. However, being able to configure that behaviour would be an interesting feature to develop in the future and, consecuently, a github issue was created time ago about it.

    In addition, note that ONTIMEINTERVAL subscriptions are no longer supported so you should avoid to use them:

    ONTIMEINTERVAL subscriptions have several problems (introduce state in CB, thus making horizontal scaling configuration much harder, and makes it difficult to introduce pagination/filtering). Actually, they aren't really needed, as any use case based on ONTIMEINTERVAL notification can be converted to an equivalent use case in which the receptor runs queryContext at the same frequency (and taking advantage of the features of queryContext, such as pagination or filtering).

    EDIT: the posibility of avoiding initial notification has been finally implemented at Orion. Details are at this section of the documentation. It is now in the master branch (so if you use fiware/orion:latest docker you will get it) and will be include in next Orion version (2.2.0).