首页 文章

使用Cygnus将Orion Context Broker 0.13.0实体发送给Cosmos

提问于
浏览
3

我正在使用Cygnus向宇宙发送数据 . 当存在对上下文代理的实体订阅时,在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中看到一个例子吗?

1 回答

  • 2

    一般订阅/通知机制适用于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必须与天鹅座中参数 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了解更多详情 .

    NOTE: 在引用元素之前包含http://,由于StackOverFlow编辑限制,我无法自行添加)

相关问题