我正在使用天鹅座将数据发送到宇宙。当有实体订阅上下文代理时,您必须在JSON消息中指定事件或在实体属性必须更新或发送给Cygnus时触发。在Cygnus文档中,出现以下链接:

https://forge.fi-ware.eu/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_User_and_Programmers_Guide#ONCHANGE

它可以在Orion Context Broker的0.13.0版本中使用吗?

首先您必须创建实体,然后创建通知?还是可以在同一JSON消息中创建实体订阅和通知?

我可以在JSON中看到示例吗?

最佳答案

常规订阅/通知机制可与Orion 0.13.0中的Cygnus一起使用(并且,通常适用于任何版本,但可能非常古老的版本除外)。一般而言,该过程将假设您已正确配置并运行了Orion和Cygnus实例:

首先,在Orion上创建订阅,使用Cygnus监听的主机/端口作为参考。订阅示例:

{
"entities": [
    {
        "type": "Room",
        "isPattern": "false",
        "id": "Room1"
    }
],
"attributes": [ ],
"reference": "cygnus_host:cygnus_port/cygnus_url",
"duration": "P1M",
"notifyConditions": [
    {
        "type": "ONCHANGE",
        "condValues": [
            "pressure",
            "temperature"
        ]
    }
]
}


其次,在Orion处更新预订中condValues的任何实体属性。考虑以上示例,“压力”或“温度”的更新将发出通知。例如。温度更新:

{
"contextElements": [
    {
        "type": "Room",
        "isPattern": "false",
        "id": "Room1",
        "attributes": [
        {
            "name": "temperature",
            "type": "centigrade",
            "value": "26.5"
        }
        ]
    }
]
}


最后,上述更新将导致通知被发送到Cygnus,依次发送到已配置的接收器,例如。 Cosmos BigData,MySQL(来自Cygnus 0.2.1)或CKAN(来自Cygnus 0.3)。

其他观察:


该通知可以包括实体的所有属性或它们的子集。此外,您可以使用实体模式订阅特定实体或组。有关详细信息,请检查Orion Context broker notifications documentation
上面的cygnus_port必须与Cygnus配置中的参数cygnusagent.sources.http-source.port的值匹配
上面的cygnus_url必须与Cygnus中的参数cygnusagent.sources.http-source.handler.notification_target的值匹配
如果您使用的是Cygnus 0.2.1或更早版本,则cygnusagent.sources.http-source.handler.orion_version的值必须与您所使用的Orion的版本匹配(Cygnus 0.3将不再使用此机制)。


请查看to Cygnus documentation了解更多详细信息。

(注意:在引用元素之前包括http://,由于StackOverFlow编辑限制,我不能自己添加它)

关于fiware - 使用天鹅座将Orion Context Broker 0.13.0实体发送到Cosmos,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24182438/

10-10 02:46