尽管报告成功,但未显示订阅

Subscription doesn't appear although success is reported

我正在尝试为 OrionCB 中现有实体的属性创建订阅。

URL http://130.206.80.120:1026/NGSI10/subscribeContext

方法 POST

Headers Content-Type: application/xml

Body

<?xml version="1.0"?>
<subscribeContextRequest>
  <entityIdList>
    <entityId type="finesce_meteo" isPattern="false">
      <id>finesce_meteo</id>
    </entityId>
  </entityIdList>
  <attributeList>
    <attribute>precip</attribute>
  </attributeList>
  <reference>http://localhost:5050/notify</reference>
  <duration>P100Y</duration>
  <notifyConditions>
    <notifyCondition>
      <type>ONCHANGE</type>
      <condValueList>
        <condValue>precip</condValue>
      </condValueList>
    </notifyCondition>
  </notifyConditions>
  <throttling>PT5S</throttling>
</subscribeContextRequest>

此操作检索 200 OK headers 代码,body:

<subscribeContextResponse>
  <subscribeResponse>
    <subscriptionId>54c5f049286043784451d08b</subscriptionId>
    <duration>P100Y</duration>
    <throttling>PT5S</throttling>
  </subscribeResponse>
</subscribeContextResponse>

问题是当我试图检查它是否已创建时。当我尝试列出订阅时,它没有出现。我正在使用这条线:

echo 'db.csubs.find().pretty()' | mongo orion

但是如果我使用 unsubscribeContextRequest 删除这个订阅,我会得到 200 OK 代码。它表明此订阅存在。

订阅存在(因为它创建和删除正常),并且在我列出订阅时任何时候都不会出现,这种情况很少见。

请问有什么问题吗?

我正在尝试启动这个 whit cygnus 进程,并停止与 cygnus 相同的进程,获得相同的结果。

此致

Mongo find() 命令 returns 与查询匹配的前 20 个结果,因此如果您的订阅数多于此(例如超过 30 个),则可能会出现特定的没有检索到您正在搜索的内容。 (使用 mongo interactive shell 您可以使用 it 命令获得下一批 20 个结果,但不确定 mongo 在非交互模式下运行时如何工作) .

因此,我建议您在查询中包含要搜索的 ID。例如,如果您在 Orion 请求中获得的 ID 是“54c90821286043500575eecf”,那么您可以使用:

echo 'db.csubs.find({_id: ObjectId("54c90821286043500575eecf")}).pretty()' | mongo orion

此外,由于您只期望一个结果,您可以使用 findOne() 并保存 pretty() 的用法,即:

echo 'db.csubs.findOne({_id: ObjectId("54c90821286043500575eecf")})' | mongo orion