Kinesis触发AWS Lambda函数时出错

时间:2017-07-10 22:03:38

标签: java amazon-web-services lambda

我有一个非常简单的AWS Lambda函数,它是用Java编写的,由Kinesis流触发。每当它运行时,我都会收到以下错误:

  

com.fasterxml.jackson.databind.JsonMappingException:冲突   属性的setter定义" encryptionType":   com.amazonaws.services.kinesis.model.Record#setEncryptionType(1   params)vs   com.amazonaws.services.kinesis.model.Record#setEncryptionType(1   PARAMS)

这是代码:

package com.domo.kinesis;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent.KinesisEventRecord;

public class TriggeredLambdaFunction {

    private LambdaLogger logger;

    public int handleRequest(KinesisEvent event, Context context) {
        logger = context.getLogger();

        for (KinesisEventRecord eventRecord : event.getRecords()) {
            String partitionKey = eventRecord.getKinesis().getPartitionKey();
            String sequenceNumber = eventRecord.getKinesis().getSequenceNumber();
            String data = new String(eventRecord.getKinesis().getData().array());
            logger.log(String.format("Partition: %s\nSequence: %s\nData: %s\n", partitionKey, sequenceNumber, data));
        }

        return event.getRecords().size();
    }
}

Record类有2种不同的setEncryptionType()方法,但这个库来自亚马逊,我无法改变它。

我需要做些什么才能让我的功能正常运行?

0 个答案:

没有答案