在不接收旧实体的情况下订阅 Orion
Subscribe Orion without receive old entities
有什么方法可以在不接收旧实体的情况下订阅 Orion(例如 Car 实体)?
示例:
Orion 有 -> 汽车 A、汽车 B。
我做 onchange 订阅,Orion 同时发给我:
汽车A通知和汽车B通知。
我们需要以下内容:
Orion 有 -> A 车、B 车。
我进行了 onchange 订阅,但目前没有收到任何信息。如果以后Orion收到了B车,或者改变了A车或者B车的一些属性,那么发送通知。
这可能吗?
行为在 the user manual:
中解释
You may wonder why accumulator-server.py is getting this message if you don't actually do any update. This is because the Orion Context Broker considers the transition from "non existing subscription" to "subscribed" as a change.
我们知道对于某些用例来说这并不方便。但是,以相反的方式行事会破坏另一个用例,这些用例需要在开始获取与实际更改相对应的通知之前知道 "inicial state" 。让每个人都满意的最佳解决方案是使其可配置,这样每个客户都可以选择自己喜欢的东西。此功能目前在我们的路线图中(请参阅 this issue in github.com)。
虽然这在 Orion 中实现了,但在您的情况下,可能的解决方法是忽略第一个收到的属于订阅的通知(您可以通过 subscriptionId
中的字段识别一个通知所属的订阅通知负载)。属于该订阅的所有以下通知将对应于实际更改。
编辑: Orion 终于实现了避免初始通知的可能性。详细信息位于 this section of the documentation。它现在在 master 分支中(所以如果你使用 fiware/orion:latest
docker 你会得到它)并将包含在下一个 Orion 版本 (2.2.0) 中。
有什么方法可以在不接收旧实体的情况下订阅 Orion(例如 Car 实体)?
示例: Orion 有 -> 汽车 A、汽车 B。
我做 onchange 订阅,Orion 同时发给我: 汽车A通知和汽车B通知。
我们需要以下内容:
Orion 有 -> A 车、B 车。
我进行了 onchange 订阅,但目前没有收到任何信息。如果以后Orion收到了B车,或者改变了A车或者B车的一些属性,那么发送通知。
这可能吗?
行为在 the user manual:
中解释You may wonder why accumulator-server.py is getting this message if you don't actually do any update. This is because the Orion Context Broker considers the transition from "non existing subscription" to "subscribed" as a change.
我们知道对于某些用例来说这并不方便。但是,以相反的方式行事会破坏另一个用例,这些用例需要在开始获取与实际更改相对应的通知之前知道 "inicial state" 。让每个人都满意的最佳解决方案是使其可配置,这样每个客户都可以选择自己喜欢的东西。此功能目前在我们的路线图中(请参阅 this issue in github.com)。
虽然这在 Orion 中实现了,但在您的情况下,可能的解决方法是忽略第一个收到的属于订阅的通知(您可以通过 subscriptionId
中的字段识别一个通知所属的订阅通知负载)。属于该订阅的所有以下通知将对应于实际更改。
编辑: Orion 终于实现了避免初始通知的可能性。详细信息位于 this section of the documentation。它现在在 master 分支中(所以如果你使用 fiware/orion:latest
docker 你会得到它)并将包含在下一个 Orion 版本 (2.2.0) 中。