I’m having a problem with some entities to make the subscriptions. The subcriptions are well done (orion responds ok. Status 201) but the url subscribed never receive any update.
I have fiware-orion launched with docker over a Centos 7.
This is an example of the entity.
{
"id": "urn:ngsi-ld:ParkingGroup:Cervantes",
"type": "ParkingGroup",
"allowedVehicleType": {
"type": "Property",
"value": "car",
"metadata": {}
},
"availableSpotNumber": {
"type": "Property",
"value": 59,
"metadata": {}
},
"category": {
"type": "Property",
"value": [
"offstreet",
"feeCharged"
],
"metadata": {}
},
"chargeType": {
"type": "Property",
"value": [
"temporatyPrice"
],
"metadata": {}
},
"description": {
"type": "Property",
"value": "Calle CervantesMálaga",
"metadata": {}
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [
"-4.4119148",
"36.7208633"
]
},
"metadata": {}
},
"name": {
"type": "Text",
"value": "Cervantes",
"metadata": {}
},
"occupancyDetectionType": {
"type": "Property",
"value": "none",
"metadata": {}
},
"permitActiveHours": {
"type": "Property",
"value": "",
"metadata": {}
},
"requiredPermit": {
"type": "Property",
"value": "noPermitNeeded",
"metadata": {}
},
"totalSpotNumber": {
"type": "Property",
"value": "414",
"metadata": {}
}
}
I try different ways of subscriptions that all of them are accepted by orion like this:
{
"description": "Notificar cambios en Aparcamientos",
"subject": {
"entities": [
{
"idPattern": ".*",
"type":"ParkingGroup"
}
],
"condition": {
"attrs": [
"availableSpotNumber"
]
}
},
"notification": {
"attrs" : ["availableSpotNumber"],
"http": {
"url": "https://webhook.site/925f3290-07af-4dc9-88d2-27bcba693be5"
}
}
}
When I update the data with this through postman in mode PUT:
http://{{orion}}/v2/entities/urn:ngsi-ld:ParkingGroup:Cervantes/attrs/availableSpotNumber/value
and Body (text/plain) with value 2
The data is well ubdate when I make in postman in mode GET:
http://{{orion}}/v2/entities/urn:ngsi-ld:ParkingGroup:Cervantes/attrs/availableSpotNumber
It returns:
{
"type": "Property",
"value": 2,
"metadata": {}
}
But url of the subscription never receives anything
what is wrong?
How can I solve it? How could I debug Orion to understand why it doesn’t update the subscriptors?
The idea is to subscribe later cygnus. I have read that I must add the attrsFormat for it in this way:
"notification": {
"http": {
"url": "https://webhook.site/925f3290-07af-4dc9-88d2-27bcba693be5"
},
"attrs" : ["availableSpotNumber"],
"attrsFormat": "legacy"
}
Thanks in advance
3
Answers
Solved. After two days fighting with the problem and having some entities that worked, I realized that when I made the subscriptions Postman added (because of the tutorials) the headers: - fiware-service openiot - fiware-servicepath /
Now it works fine.
Thanks to Jason Fox who has been trying to help me!
be careful about how do you encode location. in Ngsi v2 you need type geo:json and coordinates must be numbers not strings. in Ngsi-ld you need GeoProperty but your example entity is encoded in ngsiv2
A helpful way to troubleshoot this issue is by checking the MongoDB databases. There, you will see on which "service path" the subscription was created and if the Entities exist in the same fiware-service.
Also follow the diagnose flow provided in the documentation:Fiware-orion:Diagnose notification reception problems
Schemas created by orion;
collections for Subscriptions and Entities