Closed carloslucenah closed 7 years ago
The issue seams to appear only with JSON payload. With plain text works properly.
The new version of Proton supports JSON NGSI payloads instead of regular JSON payloads for the RESTful API. Support of regular JSON payloads is possible via producers only. The documentation for JSON NGSI structure can be found here: http://proactive-technology-online.readthedocs.io/en/latest/ProtonUserGuide_FI_WARE5_4_1/index.html#appendix in the "Getting Events from the Context Broker" section
In new version, when sending a POST request to /ProtonOnWebServer/rest/events with this payload:
{"Name":"TrafficReport", "volume":"1621"}
The response is a 500 HTTP code.
The log here:
SEVERE: Could not parse JSON NGSI event org.apache.wink.json4j.JSONException: The key [data] was not in the map, reason: The key [data] was not in the map
However, the three events sent by the producer are received properly:INFO: routeTimedObject: forwarding event TrafficReport; Certainty=0.0; Duration=0.0; ExpirationTime=null; Cost=0.0; Annotation=; Name=TrafficReport; OccurrenceTime=null; volume=1000; EventSource=; EventId=06015d43-d607-45c8-b844-1b4c3a19fe0d; DetectionTime=1475672812032; Chronon=null; to consumer... INFO: routeTimedObject: forwarding event TrafficReport; Certainty=0.0; Duration=0.0; ExpirationTime=null; Cost=0.0; Annotation=; Name=TrafficReport; OccurrenceTime=null; volume=1600; EventSource=; EventId=ad6a0e81-53a8-4b41-bd11-f1c3fa432631; DetectionTime=1475672817041; Chronon=null; to consumer... INFO: routeTimedObject: forwarding event TrafficReport; Certainty=0.0; Duration=0.0; ExpirationTime=null; Cost=0.0; Annotation=; Name=TrafficReport; OccurrenceTime=null; volume=2500; EventSource=; EventId=9f1bdd02-3df3-4c90-8d74-91c624845de4; DetectionTime=1475672822043; Chronon=null; to consumer... INFO: routeTimedObject: forwarding event ExpectedCrash; OccurrenceTime=1475672822046; EventSource=; Certainty=0.0; EventId=44fc222f-67aa-421f-8600-e13f94ab82f6; DetectionTime=1475672822046; Duration=0.0; ExpirationTime=null; Cost=10.0; Annotation=; Name=ExpectedCrash; Chronon=null; to consumer...
The payload of them:
{"Name":"TrafficReport", "volume":"1000"} {"Name":"TrafficReport", "volume":"1600"} {"Name":"TrafficReport", "volume":"2500"}
Downgrading to 4.4.1, with the same configuration, makes the HTTP requests to REST API to work perfectly.