首页 > 解决方案 > 通知限制有不良行为

问题描述

我已经部署了一个空 Orion 并连接了一个每 10 秒发送一次更新的设备。我需要每 10 分钟收到一个通知,因此我创建了一个限制为 600 秒的通知。

问题是我在第一个通知之后的同一分钟甚至几秒钟内收到了两个通知。

1)orion版本的一个实例:2.2.0

2) 猎户座订阅

[
    {
        "id": "5e9ec90d9e2ba22996168d78",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id1",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 521026,
            "lastNotification": "2020-05-21T10:52:53.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-20T16:46:58.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:53.00Z",
            "lastSuccessCode": 500
        }
    },
    {
        "id": "5e9ec96f9e2ba22996168d79",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id2",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 526757,
            "lastNotification": "2020-05-21T10:52:50.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-21T09:32:34.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:50.00Z",
            "lastSuccessCode": 500
        }
    },
    {
        "id": "5e9ec9899e2ba22996168d7a",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id3",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 541814,
            "lastNotification": "2020-05-21T10:52:47.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-21T01:49:52.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:48.00Z",
            "lastSuccessCode": 500
        }
    },
    {
        "id": "5e9ec9a69e2ba22996168d7b",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id3",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 470859,
            "lastNotification": "2020-05-21T10:52:47.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-20T21:01:32.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:47.00Z",
            "lastSuccessCode": 500
        }
    },
    {
        "id": "5e9ec9c09e2ba22996168d7c",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id4",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 532901,
            "lastNotification": "2020-05-21T10:52:44.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-21T08:33:10.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:45.00Z",
            "lastSuccessCode": 500
        }
    },
    {
        "id": "5e9ec9ff9e2ba22996168d7d",
        "description": "Notificaciones a Arcgis",
        "expires": "2040-01-01T14:00:00.00Z",
        "status": "active",
        "subject": {
            "entities": [
                {
                    "id": "id5",
                    "type": "aqss"
                }
            ],
            "condition": {
                "attrs": []
            }
        },
        "notification": {
            "timesSent": 520974,
            "lastNotification": "2020-05-21T10:52:53.00Z",
            "attrs": [],
            "attrsFormat": "normalized",
            "http": {
                "url": "http://test.eu/notify/"
            },
            "metadata": [
                "dateCreated",
                "dateModified"
            ],
            "lastFailure": "2020-05-21T05:30:58.00Z",
            "lastFailureReason": "Timeout was reached",
            "lastSuccess": "2020-05-21T10:52:53.00Z",
            "lastSuccessCode": 500
        }
    }
]

3) Orion 在 docker 实例中运行

[root@271386b095c6 /]# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ssl  320:12 /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -dbhost mongo -corsOrigin __ALL -logLevel DEBUG
 9248 pts/0    Ss     0:00 bash
 9293 pts/0    R+     0:00 ps ax

4) 待定...

5)实体和订阅属于同一个服务和服务路径

在此处输入图像描述

谢谢

标签: fiware-orion

解决方案


查看上面的信息,您似乎有很多订阅。如果我数对了,其中六个。

不确定它们是否都涵盖相同的实体/属性,但我的建议是简化您的方案,只留下一个订阅并再次测试。

您可以使用 删除订阅DELETE /v2/subscriptions/{subId}


推荐阅读