use of com.amazonaws.http.timers.client.SdkInterruptedException in project flink by apache.
the class FanOutShardSubscriberTest method testInterruptedErrorThrownToConsumer.
@Test
public void testInterruptedErrorThrownToConsumer() throws Exception {
thrown.expect(FanOutShardSubscriber.FanOutSubscriberInterruptedException.class);
SdkInterruptedException error = new SdkInterruptedException(null);
SubscriptionErrorKinesisV2 errorKinesisV2 = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(error);
FanOutShardSubscriber subscriber = new FanOutShardSubscriber("consumerArn", "shardId", errorKinesisV2, DEFAULT_SUBSCRIBE_TO_SHARD_TIMEOUT);
software.amazon.awssdk.services.kinesis.model.StartingPosition startingPosition = software.amazon.awssdk.services.kinesis.model.StartingPosition.builder().build();
subscriber.subscribeToShardAndConsumeRecords(startingPosition, event -> {
});
}
use of com.amazonaws.http.timers.client.SdkInterruptedException in project flink by apache.
the class FanOutRecordPublisherTest method testInterruptedPublisherReturnsCancelled.
@Test
public void testInterruptedPublisherReturnsCancelled() throws Exception {
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(new SdkInterruptedException(null));
RecordPublisher publisher = createRecordPublisher(kinesis, StartingPosition.continueFromSequenceNumber(SEQUENCE_NUMBER));
RecordPublisherRunResult actual = publisher.run(new TestConsumer());
assertEquals(CANCELLED, actual);
}
use of com.amazonaws.http.timers.client.SdkInterruptedException 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);
}
Aggregations