Details
-
Type:
Monitor
-
Status: Closed
-
Priority:
Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Enabler:Orion
Description
Created question in FIWARE Q/A platform on 10-12-2018 at 18:12
Please, ANSWER this question AT https://stackoverflow.com/questions/53710837/conflict-error-when-obtaining-attributes-in-fiware-orion-context-broker
Question:
Conflict Error when obtaining attributes in FIWARE Orion Context Broker
Description:
I cannot get any entity attribute when I have context provider registered. I constantly get the same 409 conflict error. How can I prevent having two objects with the same id and merge them into one?
SETUP
I have whole Orion Context Broker all setup and running after following this commands:
docker pull mongo:3.6
docker pull fiware/orion:2.0.0
docker network create fiware_default
docker run -d --name=mongo-db --network=fiware_default \
--expose=27017 mongo:3.6 --bind_ip_all --smallfiles
docker run -d --name fiware-orion -h orion --network=fiware_default \
-p 1026:1026 fiware/orion:2.0.0 -dbhost mongo-db
ENTITIES
I have one Car entity:
{
"id": "urn:ngsi-ld:Car:001",
"type": "Car",
"brandName": {
"type": "Property",
"value": "Mercedes",
"metadata": {}
},
"location": {
"type": "geo:json",
"value":
,
"metadata": {}
},
"name": {
"type": "Text",
"value": "MyCar",
"metadata": {}
}
}
Moreover I also registered my Context Provider:
{
"description": "Temperature",
"dataProvided": {
"entities": [
],
"attrs": [
"temperature"
]
},
"provider": {
"http":
,
"legacyForwarding": true
}
}
CONTEXT PROVIDER
I exposed locally my Context Provider (exposed by my SpringBoot application written in Java 10) at http://192.168.xxx.xxx:8080/temperature/1/queryContext. The JSON data (returned in html body) is in NSGI v1 format and looks like that:
{
"contextResponses": [
{
"contextElement": {
"attributes": [
],
"id": "urn:ngsi-ld:Car:001",
"isPattern": "false",
"type": "Car"
},
"statusCode":
}
]
}
PROBLEM
When I try to get attribute (location) without registered context, it works fine for me, but after context registration it fails (I get 409 Conflict Error).
{ "error": "TooManyResults", "description": "More than one matching entity. Please refine your query" }On the other hand, I can remove entity by id and then I can get temperature for not existing object.
When I have both entity and context provider for this entity and I make this query:
curl GET 'http://localhost:1026/v2/entities?type=Car&options=keyValues'
I receive list of objects with the same ids:
[
{"id":"urn:ngsi-ld:Car:001","type":"Car","brandName":"Mercedes","location":,"name":"MyCar"},
{"id":"urn:nsgi-ld:Car:001","type":"Car","temperature":"-10"}]
What should I do to prevent this id conflict? How to prevent having two objects with the same id when registering context provider?
Activity
- All
- Comments
- History
- Activity
- Transitions
2018-12-10 21:05|CREATED monitor | # answers= 0, accepted answer= False