FIWARE Cygnus -> cartodb sinks.NGSISink: erro de persistência, 400 solicitação incorreta
Estou tentando conectar o cygnus (1.4.0_SNAPSHOT) ao cartodb. Eu o executo localmente e uso um script para enviar uma notificação ao cygnus. O script roda Ok, mas o cygnus diz:
ERROR sinks.NGSISink: Persistence error (The query 'INSERT INTO jcarneroatos.x002fpeoplelocation (recvtime,fiwareservicepath,entityid,entitytype,the_geom) VALUES ('2016-10-31T19:04:00.994Z','/peoplelocation','Person:1','Person',ST_SetSRID(ST_MakePoint({"coordinates":[-4.423032856,36.721290055]), 4326))' could not be executed. CartoDB response: 400 Bad Request)
Alguém sabe o que poderia estar acontecendo? Abaixo coloquei meus arquivos de configuração para obter informações, obrigado!
Meu nome de usuário na CARTO é "jcarneroatos" e o domínio éhttps://jcarneroatos.carto.com. Este é o script que estou usando para simular a notificação do Orion Context Broker:
#/bin/bash
HOST=localhost
PORT=5050
SERVICE=jcarneroatos
SUBSERVICE=/peoplelocation
#send notification
NOTIFICATION=$(\
curl http://$HOST:$PORT/notify \
-v -s -S \
--header "Content-Type: application/json; charset=utf-8" \
--header 'Accept: application/json' \
--header "Fiware-Service: $SERVICE" \
--header "Fiware-ServicePath: $SUBSERVICE" \
-d '
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"metadatas": [
{
"name": "location",
"type": "string",
"value": "WGS84"
}
],
"name": "location",
"type": "geo:json",
"value": {
"coordinates": [
-4.423032856,
36.721290055
],
"type": "Point"
}
}
],
"id": "Person:1",
"isPattern": "false",
"type": "Person"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
],
"originator": "localhost",
"subscriptionId": "58178396634ded66caac35b2"
}')
if [ -z "$NOTIFICATION" ]; then
echo "Ok"
else
echo $NOTIFICATION
fi
Esta é a estrutura do conjunto de dados no cartodb:
x002fpeoplelocation
cartodb_id | the_geom | entityid | entitytype | fiwareservicepath | recvtime
number | geometry | string | string | string | date
Este é o arquivo de configuração do cygnus:
cygnusagent.sources = http-source
cygnusagent.sinks = cartodb-sink
cygnusagent.channels =cartodb-channel
cygnusagent.sources.http-source.channels = cartodb-channel
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnusagent.sources.http-source.port = 5050
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
cygnusagent.sources.http-source.handler.notification_target = /notify
cygnusagent.sources.http-source.handler.default_service = jcarneroatos
cygnusagent.sources.http-source.handler.default_service_path = /peoplelocation
cygnusagent.sources.http-source.interceptors = ts gi
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$Builder
cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /home/cygnus/APACHE_FLUME_HOME/conf/grouping_rules.conf
cygnusagent.sinks.cartodb-sink.type = com.telefonica.iot.cygnus.sinks.NGSICartoDBSink
cygnusagent.sinks.cartodb-sink.channel = cartodb-channel
cygnusagent.sinks.cartodb-sink.enable_grouping = false
cygnusagent.sinks.cartodb-sink.enable_name_mappings = false
cygnusagent.sinks.cartodb-sink.enable_lowercase = false
cygnusagent.sinks.cartodb-sink.data_model = dm-by-service-path
cygnusagent.sinks.cartodb-sink.keys_conf_file = /home/cygnus/APACHE_FLUME_HOME/conf/cartodb_keys.conf
cygnusagent.sinks.cartodb-sink.flip_coordinates = false
cygnusagent.sinks.cartodb-sink.enable_raw = true
cygnusagent.sinks.cartodb-sink.enable_distance = false
cygnusagent.sinks.cartodb-sink.batch_size = 100
cygnusagent.sinks.cartodb-sink.batch_timeout = 30
cygnusagent.sinks.cartodb-sink.batch_ttl = 10
cygnusagent.sinks.cartodb-sink.backend.max_conns = 500
cygnusagent.sinks.cartodb-sink.backend.max_conns_per_route = 100
cygnusagent.channels.cartodb-channel.type = memory
cygnusagent.channels.cartodb-channel.capacity = 1000
cygnusagent.channels.cartodb-channel.transactionCapacity = 100
E finalmente o arquivo cartodb_keys.conf (sem chave):
{
"cartodb_keys": [
{
"username": "jcarneroatos",
"endpoint": "https://jcarneroatos.carto.com",
"key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
]
}
Atualizar: Após executar o Cygnus no modo DEBUG e verificar os logs, parece que o CARTO está retornando:
{"error":["syntax error at or near \"{\""]}
Este é o log completo:http://pastebin.com/p9VyUU8n