Flink job can not produce record to kinesis stream after changing FlinkKinesisProducer to KinesisStreamsSink

Viewed 47

I have one Flink job integration test that will produce some records to a localstack kinesis stream. When I use Flink 1.14.4, I have a FlinkKinesisProduer writing to a kinesis stream that localstack created, and the test will spin up the taskmanager/jobmanager and records can be found after Flink Job got executed.

Localstack kinesis steam creation:

    AwsClientBuilder.EndpointConfiguration endpointConfiguration =
        new AwsClientBuilder.EndpointConfiguration(
            String.format("http://%s:%s", MOCK_SERVICE_URL, AWS_PORT),
            REGION);

amazonKinesis =
        AmazonKinesisClientBuilder.standard()
            .withEndpointConfiguration(endpointConfiguration)
            .build();

After the recent 1.15.1 release, I tried to upgrade my Flink version and since the new release came with the new Kinesis Producer Builder that uses the AWS v2 SDK for Java whereas the old sink uses the Kinesis Producer Library, I replaced my Sink with the following code:

KinesisStreamsSinkBuilder<MyData> builder =
        KinesisStreamsSink.<MyData>builder()
        .setKinesisClientProperties(kinesisProducerConfig)
        .setSerializationSchema(AbstractMessageLite::toByteArray)
        .setPartitionKeyGenerator(element -> String.valueOf(element.hashCode()))
        .setStreamName(outputConfig.getKinesisName())
        .setFailOnError(false));

New dependencies lib:

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-connector-aws-kinesis-streams</artifactId>
    <version>1.15.1</version>
</dependency>

This is when I start noticing my job can not push any records to the localstack kinesis anymore, I can see logs right before pushing the records to the sink, so the Flink job main logic is correct, but nothing shows up in the stream when I try to getRecord(). I wonder if this is caused due to the new AWS v2 SDK support, but I'm not sure. Anyone has any insights?

0 Answers
Related