我有一个用例,我必须验证发送给Kinesis firehose的有效负载确实正在发送。
为了做到这一点,我想出了连锁Firehose - > Firehose数据转换(使用lambda) - > DDB - >检查DDB中的有效负载(有效负载是DDB中的散列键)。我必须以编程方式一次性定义整个链。数据转换与http://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html相同。
我正在做这一切,因为我无法完全控制它进入的S3存储桶中的文件名。所以我需要将确切的有效负载发送到某个持久密钥值存储区。
问题是
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/kinesisfirehose/model/CreateDeliveryStreamRequest.html似乎不支持添加数据转换lambda。
我的问题是,这是否可行,即使只触摸一次控制台(完全通过AWS Kinesis Firehose API)。
或者确实有任何替代建议以某种方式将数据移动到DDB。
答案 0 :(得分:2)
好吧,经过多方努力和文件搜索,我才弄清楚了。
您必须使用lambda ARN定义处理配置以定义数据转换。
以下是代码中的这种配置。
final ProcessingConfiguration processingConfiguration =
new ProcessingConfiguration().withEnabled(true)
.withProcessors(newProcessor().withType(ProcessorType.Lambda)
.withParameters(new ProcessorParameter().withParameterName(LambdaArn)
.withParameterValue(lamdbaFunctionArn)));
final CreateDeliveryStreamResult describeDeliveryStreamResult =
client.createDeliveryStream(new CreateDeliveryStreamRequest().withExtendedS3DestinationConfiguration(
new ExtendedS3DestinationConfiguration()
.withBucketARN(s3BucketARN)
.withRoleARN(roleArn)
.withPrefix(keyPrefix)
.withProcessingConfiguration(processingConfiguration))
.withDeliveryStreamName(streamName));
这里ARN是各种对象的资源名称(S3目的地,数据变换lambda,IAM角色等)。
答案 1 :(得分:0)
您可以具有lambda函数来指定任务。 https://github.com/hixichen/golang_lamda_decode_protobuf_firehose