Why cepheus don't send int without quotes to o

2019-07-16 19:45发布

In this question I have a problem that the orion conditions were not satisfied but it was solved by removing the quotes on the especial value Why this orion subscription don't works as I want?

The new problem is that when I process an event with cep that calculates the mFlag int attribute it send it to orion but apparently it is send with the quotes (same problem as described in the related question posted before) because the orion entity is changed but the notification is not triggered.

The cepheus cep config out is like this one:

"out":[
    {
      "id":"algo",
      "type":"Event",
      "brokers":[
        {
          "url":"http://localhost:1026" //orion
        }
      ],
      "attributes":[
         { "name":"IdEvent", "type":"int" },
         { "name":"mFlag", "type":"int" }
      ]
    }
  ],

Is this problem of the cepheus cep or it is a orion bug not interpreting the type of the attribute in the conditions?

1条回答
▲ chillily
2楼-- · 2019-07-16 20:38

You seem to have hit an incompatibility in the NGSIv1 protocol implementation between Cepheus and Orion.

NGSIv1 has been well defined for its XML format (as a OMA standard), but not for its JSON version. The Cepheus team has based the JSON implementation one of the only existing document defining the JSON format of NGSIv1: the API Walkthough of the Orion documentation.

In this document, all values are exchanged (like in the XML format of the stantard) as strings. Therefore, Cepheus uses strings regardless of the type of the value.

If we were to decide to use some other representation than JSON strings for values, we would need a document (a proper specification for the NGSIv1 JSON !) defining which types can be represented as a JSON number.

查看更多
登录 后发表回答