Cygnus to Ckan - 运行时错误(不知道如何处理响应代码409)

时间:2016-02-16 13:04:23

标签: fiware fiware-orion ckan fiware-cygnus

我正在尝试将Cygnus与CKAN一起使用,但是当我将通知发送到CKAN中时,我收到错误。

天鹅座日志:

time=2016-02-17T10:01:11.601CET | lvl=INFO | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[209] : Starting transaction (1455699663-312-0000000000)
time=2016-02-17T10:01:11.606CET | lvl=INFO | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[236] : Received data ({    "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8",    "originator" : "localhost",    "contextResponses" : [        {            "contextElement" : {                "attributes" : [                    {                        "name" : "temperature",                        "type" : "float",                        "value" : "26.5"                    }                ],                "type" : "Room",                "isPattern" : "false",                "id" : "Room1"            },            "statusCode" : {                "code" : "200",                "reasonPhrase" : "OK"            }        }    ]})
time=2016-02-17T10:01:11.608CET | lvl=INFO | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[259] : Event put in the channel (id=1231327840, ttl=10)
time=2016-02-17T10:01:34.311CET | lvl=INFO | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=processNewBatches | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[351] : Batch accumulation time reached, the batch will be processed as it is
time=2016-02-17T10:01:34.319CET | lvl=INFO | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=persistAggregation | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionCKANSink[382] : [ckan-sink] Persisting data at OrionCKANSink (orgName=testjsb, pkgName=testjsb_testjsb, resName=room1_room, data={"recvTimeTs": "1455699671","recvTime": "2016-02-17T09:01:11.609Z","fiwareServicePath": "testjsb","entityId": "Room1","entityType": "Room","attrName": "temperature","attrType": "float","attrValue": "26.5"})
time=2016-02-17T10:01:36.129CET | lvl=ERROR | trans=1455699663-312-0000000000 | srv=testjsb | subsrv=testjsb | function=processNewBatches | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[424] : Runtime error (Don't know how to treat response code 409)

我的天鹅座代理配置:

cygnusagent.sources = http-source
cygnusagent.sinks = ckan-sink
cygnusagent.channels = ckan-channel

#=============================================
# source configuration
# channel name where to write the notification events
cygnusagent.sources.http-source.channels = ckan-channel
# source class, must not be changed
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
# listening port the Flume source will use for receiving incoming notifications
cygnusagent.sources.http-source.port = 5050
# Flume handler that will parse the notifications, must not be changed
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler
# URL target
cygnusagent.sources.http-source.handler.notification_target = /notify
# Default service (service semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service = testjsb
# Default service path (service path semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service_path = testjsb
# Number of channel re-injection retries before a Flume event is definitely discarded (-1 means infinite retries)
cygnusagent.sources.http-source.handler.events_ttl = 10
# Source interceptors, do not change
cygnusagent.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
# GroupinInterceptor, do not change
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
# Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
# See the doc/design/interceptors document for more details
cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf

# ============================================
# OrionCKANSink configuration
# channel name from where to read notification events
cygnusagent.sinks.ckan-sink.channel = ckan-channel
# sink class, must not be changed
cygnusagent.sinks.ckan-sink.type = com.telefonica.iot.cygnus.sinks.OrionCKANSink
# true if the grouping feature is enabled for this sink, false otherwise
cygnusagent.sinks.ckan-sink.enable_grouping = false
# the CKAN API key to use
cygnusagent.sinks.ckan-sink.api_key = myapikey
# the FQDN/IP address for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_host = demo.ckan.org
# the port for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_port = 80
# Orion URL used to compose the resource URL with the convenience operation URL to query it
cygnusagent.sinks.ckan-sink.orion_url = http://localhost:1026
# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.ckan-sink.attr_persistence = row
# enable SSL for secure Http transportation; 'true' or 'false'
cygnusagent.sinks.ckan-sink.ssl = false
# number of notifications to be included within a processing batch
cygnusagent.sinks.ckan-sink.batch_size = 100
# timeout for batch accumulation
cygnusagent.sinks.ckan-sink.batch_timeout = 30

#=============================================
# ckan-channel configuration
# channel type (must not be changed)
cygnusagent.channels.ckan-channel.type = memory
# capacity of the channel
cygnusagent.channels.ckan-channel.capacity = 1000
# amount of bytes that can be sent per transaction
cygnusagent.channels.ckan-channel.transactionCapacity = 100

通知代码:

curl http://localhost:5050/notify -v -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- <<EOF
{
    "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8",
    "originator" : "localhost",
    "contextResponses" : [
        {
            "contextElement" : {
                "attributes" : [
                    {
                        "name" : "temperature",
                        "type" : "float",
                        "value" : "26.5"
                    }
                ],
                "type" : "Room",
                "isPattern" : "false",
                "id" : "Room1"
            },
            "statusCode" : {
                "code" : "200",
                "reasonPhrase" : "OK"
            }
        }
    ]
}
EOF

当天鹅座将数据保存到demo.ckan.org时,组织,数据集和资源都会被创建,但不会加载数据。

http://demo.ckan.org/dataset/testjsb_testjsb/resource/0d9a8394-3d57-4450-b764-f3dbe2287127

0 个答案:

没有答案