Search in sources :

Example 1 with FanOutRecordPublisherFactory

use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherFactory in project flink by apache.

the class ShardConsumerFanOutTest method testShardConsumerExitsWhenRecordPublisherIsInterrupted.

@Test
public void testShardConsumerExitsWhenRecordPublisherIsInterrupted() throws Exception {
    // Throws error after 5 records
    KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(new SdkInterruptedException(null));
    int expectedNumberOfRecordsReadFromKinesisBeforeError = 5;
    SequenceNumber startingSequenceNumber = new SequenceNumber("0");
    SequenceNumber expectedLastProcessSequenceNumber = new SequenceNumber("5");
    // SdkInterruptedException will terminate the consumer, it will not retry and read only the
    // first 5 records
    ShardConsumerTestUtils.assertNumberOfMessagesReceivedFromKinesis(expectedNumberOfRecordsReadFromKinesisBeforeError, new FanOutRecordPublisherFactory(kinesis), startingSequenceNumber, efoProperties(), expectedLastProcessSequenceNumber);
}
Also used : SdkInterruptedException(com.amazonaws.http.timers.client.SdkInterruptedException) ShardConsumerTestUtils.fakeSequenceNumber(org.apache.flink.streaming.connectors.kinesis.internals.ShardConsumerTestUtils.fakeSequenceNumber) SequenceNumber(org.apache.flink.streaming.connectors.kinesis.model.SequenceNumber) FanOutRecordPublisherFactory(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherFactory) KinesisProxyV2Interface(org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface) Test(org.junit.Test)

Aggregations

SdkInterruptedException (com.amazonaws.http.timers.client.SdkInterruptedException)1 ShardConsumerTestUtils.fakeSequenceNumber (org.apache.flink.streaming.connectors.kinesis.internals.ShardConsumerTestUtils.fakeSequenceNumber)1 FanOutRecordPublisherFactory (org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherFactory)1 SequenceNumber (org.apache.flink.streaming.connectors.kinesis.model.SequenceNumber)1 KinesisProxyV2Interface (org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface)1 Test (org.junit.Test)1