Search code examples
paginationfiware-orionfiwarefiware-wirecloud

Pagination in subscription


I have an operator that performs subscriptions for specific types of orion entities. However, although i use the relevant field (limit) in the options object i push for the subscription, data still arrive paginated at 20 elements (I would like to increase it). Is pagination (limit) option valid only for query operations, or is it available for subscriptions as well?

Here is my code:

var subscribe = function subscribe() {
    this.connection = new NGSI.Connection(this.ngsi_server, {
        ngsi_proxy_url: this.ngsi_proxy
    });

    var attributeList = null;
    var duration = this.subscriptionUpdateRate;
    var throttling = null;
    var notifyConditions = [{
            'type': 'ONCHANGE',
            'condValues': this.condValues
        }];
    var options = {
        flat: true,
        limit: 999,
        onNotify: function(data) {
            handlerReceiveEntity(data);
        },
        onSuccess: function(data) {
            ....
            window.addEventListener("beforeunload", function() {
                this.connection.cancelSubscription(this.subscriptionID);
            }.bind(this));
        }.bind(this)
    };
    this.connection.createSubscription([this.entities], attributeList, duration, throttling, notifyConditions, options);
};

Still, I am getting only 20 entities instead of ~40 when the function is first invoked. Any idea what might be wrong?

The version of Orion is 0.14.0.


Solution

  • As far as I know the Orion Context Broker doesn't allow the use of the limit/offset parameters in subscriptions, it usage is limited to the query operations. Moreover, I have never see paginated notifications. Anyway, if this is a change in the Orion Context Broker API, please create a ticket in the WireCloud's issue tracker.

    See Orion Context Broker - User and Programmers Guide for more info, but I don't see any relevant change that can explain this behaviour.