CrynetLogistics commented on a change in pull request #18314: URL: https://github.com/apache/flink/pull/18314#discussion_r789795870
########## File path: docs/content.zh/docs/connectors/datastream/firehose.md ########## @@ -0,0 +1,171 @@ +--- +title: Firehose +weight: 5 +type: docs +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +# Amazon Kinesis Firehose Sink + +The Firehose sink writes to [Amazon AWS Kinesis Firehose](https://aws.amazon.com/kinesis/data-firehose/). + +Follow the instructions from the [Amazon Kinesis Firehose Developer Guide](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html) +to setup a Kinesis Data Firehose delivery stream. + +To use the connector, add the following Maven dependency to your project: + +{{< artifact flink-connector-aws-kinesis-firehose >}} + +The `KinesisFirehoseSink` uses [AWS v2 SDK for Java](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/home.html) to write data from a Flink stream into a Firehose delivery stream. + +{{< tabs "42vs28vdth5-nm76-6dz1-5m7s-5y345bu56se5u66je" >}} +{{< tab "Java" >}} +```java +KinesisFirehoseSinkElementConverter<String> elementConverter = + KinesisFirehoseSinkElementConverter.<String>builder() + .setSerializationSchema(new SimpleStringSchema()) + .build(); + +Properties sinkProperties = new Properties(); +// Required +sinkProperties.put(AWSConfigConstants.AWS_REGION, "eu-west-1"); +// Optional, provide via alternative routes e.g. environment variables +sinkProperties.put(AWSConfigConstants.AWS_ACCESS_KEY_ID, "aws_access_key_id"); +sinkProperties.put(AWSConfigConstants.AWS_SECRET_ACCESS_KEY, "aws_secret_access_key"); + +KinesisFirehoseSink<String> kdfSink = + KinesisFirehoseSink.<String>builder() + .setKinesisClientProperties(sinkProperties) // Required + .setElementConverter(elementConverter) // Required + .setDeliveryStreamName("your-stream-name") // Required + .setFailOnError(false) // Optional + .setMaxBatchSize(500) // Optional + .setMaxInFlightRequests(50) // Optional + .setMaxBufferedRequests(10_000) // Optional + .setMaxBatchSizeInBytes(4 * 1024 * 1024) // Optional + .setMaxTimeInBufferMS(5000) // Optional + .setMaxRecordSizeInBytes(1000 * 1024) // Optional + .build(); + +flinkStream.sinkTo(kdfSink); +``` +{{< /tab >}} +{{< tab "Scala" >}} +```scala +val elementConverter = + KinesisFirehoseSinkElementConverter.<String>builder() + .setSerializationSchema(new SimpleStringSchema()) + .build() + +Properties sinkProperties = new Properties() +// Required +sinkProperties.put(AWSConfigConstants.AWS_REGION, "eu-west-1") +// Optional, provide via alternative routes e.g. environment variables +sinkProperties.put(AWSConfigConstants.AWS_ACCESS_KEY_ID, "aws_access_key_id") +sinkProperties.put(AWSConfigConstants.AWS_SECRET_ACCESS_KEY, "aws_secret_access_key") + +val kdfSink = + KinesisFirehoseSink.<String>builder() + .setKinesisClientProperties(sinkProperties) // Required + .setElementConverter(elementConverter) // Required + .setDeliveryStreamName("your-stream-name") // Required + .setFailOnError(false) // Optional + .setMaxBatchSize(500) // Optional + .setMaxInFlightRequests(50) // Optional + .setMaxBufferedRequests(10_000) // Optional + .setMaxBatchSizeInBytes(4 * 1024 * 1024) // Optional + .setMaxTimeInBufferMS(5000) // Optional + .setMaxRecordSizeInBytes(1000 * 1024) // Optional + .build() + +flinkStream.sinkTo(kdfSink) +``` +{{< /tab >}} +{{< /tabs >}} + +## Configurations + +Flink's Cassandra sink is created by using the static builder `KinesisFirehoseSink.<String>builder()`. + +1. __setKinesisClientProperties(Properties sinkProperties)__ + * Required. + * Supplies credentials, region and other parameter to the firehose client. Review comment: Agreed, it should be `setFirehoseClientProperties` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
