如何配置Cepheus CEP使它返回json到orion而不是xml?

时间:2016-05-13 11:01:57

标签: fiware fiware-orion

最近我开始使用Cepheus CEP,但是根据文档,我无法将其插入到orion实体中。看看我对accumulator.py的错误,我发现cepheus cep将xml查询发送给猎户座。是不是在orion中弃用了?

cepheus cep中使用的配置:

{
  "host":"http://localhost:1028",
  "in":[
    {
      "id":"Room.*",
      "type":"Room",
      "isPattern":true,
      "providers":[
        "http://localhost:1027"
      ],
      "attributes":[
        { "name":"temperature", "type":"double" },
        { "name":"floor", "type":"string" }
      ]
    }
  ],
  "out":[
    {
      "id":"Floor1",
      "type":"Floor",
      "brokers":[
        {
          "url":"http://localhost:1029"
        }
      ],
      "attributes":[
        { "name":"temperature", "type":"double" }
      ]
    }
  ],
  "statements":[
    "INSERT INTO Floor SELECT floor as id, avg(temperature) as temperature FROM Room.win:time(10 min) GROUP BY floor OUTPUT LAST EVERY 10 sec"
  ]
}
  • 1029 Orion Broker
  • 1028 Cepheus CEP
  • 1027 Cepheus Broker

我使用accumulator.py获得的回复:

127.0.0.1 - - [13/May/2016 05:50:46] "POST /ngsi10/updateContext HTTP/1.1" 200 -
POST http://localhost:1029/ngsi10/updateContext
Content-Length: 404
User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_91)
Connection: Keep-Alive
Host: localhost:1029
Accept: application/xml
Content-Type: application/xml

<updateContextRequest><updateAction>APPEND</updateAction><contextElementList><contextElement><entityId type="Floor" isPattern="false"><id>Floor1</id></entityId><contextAttributeList><contextAttribute><name>temperature</name><type>double</type><contextValue>22.333333333333332</contextValue><metadata/></contextAttribute></contextAttributeList></contextElement></contextElementList></updateContextRequest>=======================================

如果我在Cepheus Broker中启用了

remote.forward.updateContext = true

使用正确的代理配置我收到以下错误:

2016-05-13 06:07:08.504  WARN 12977 --- [nio-1027-exec-8] c.o.c.broker.controller.NgsiController   : UpdateContext failed for http://localhost:1026: org.springframework.web.client.HttpClientErrorException: 415 Unsupported Media Type

我认为这个错误也是因为查询的xml格式而产生的。

1 个答案:

答案 0 :(得分:2)

Cepheus 0.1.16在0.28之后与Orion不兼容,因为删除了XML支持。我向Cepheus添加了一个问题来跟踪此问题:https://github.com/Orange-OpenSource/fiware-cepheus/issues/51

[更新] Cepheus 0.1.17以JSON作为NGSI交换的默认格式发布。