Reputation: 57
I'm trying to create a subscription for attributes of an existing entity in OrionCB.
URL http://130.206.80.120:1026/NGSI10/subscribeContext
Method 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>
This operation retrieves 200 OK headers code, with this body:
<subscribeContextResponse>
<subscribeResponse>
<subscriptionId>54c5f049286043784451d08b</subscriptionId>
<duration>P100Y</duration>
<throttling>PT5S</throttling>
</subscribeResponse>
</subscribeContextResponse>
The problem is when I'm trying to check if it's created. When I'm trying to list subscriptions, it doesn't appears. I'm using this line:
echo 'db.csubs.find().pretty()' | mongo orion
But if I delete this subscription with unsubscribeContextRequest, I get 200 OK code. It suggests this subscription exists.
The fact a subscription exists (because it's created and deleted ok), and not appears any moment when i listing subscriptions, is rare.
Please, is there something wrong?
I'm trying this whit cygnus proccess started, and the same process with cygnus stopped, obtaining the same result.
Regards
Upvotes: 2
Views: 129
Reputation: 12294
Mongo find()
command returns the first 20 results matching the query, thus if you have more subscriptions than that (e.g. more than 30) it may happen that the particular one you are searching for is not retrieved. (With mongo interactive shell you can get the next batch of 20 result using the it
command, but not sure how this work when mongo runs in non-interactive mode).
Thus, I'd recommend you include the id you are searching for in the query. For example, if the id you get in the Orion request is "54c90821286043500575eecf" then you could use:
echo 'db.csubs.find({_id: ObjectId("54c90821286043500575eecf")}).pretty()' | mongo orion
Morevoer, as you are expecting just one result, you can use findOne()
and save the usage of pretty()
, i.e.:
echo 'db.csubs.findOne({_id: ObjectId("54c90821286043500575eecf")})' | mongo orion
Upvotes: 0