use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SubscriptionErrorKinesisV2 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 org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SubscriptionErrorKinesisV2 in project flink by apache.
the class FanOutShardSubscriberTest method testRetryableErrorThrownToConsumer.
@Test
public void testRetryableErrorThrownToConsumer() throws Exception {
thrown.expect(FanOutShardSubscriber.RetryableFanOutSubscriberException.class);
thrown.expectMessage("Error!");
RuntimeException error = new RuntimeException("Error!");
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 org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SubscriptionErrorKinesisV2 in project flink by apache.
the class FanOutShardSubscriberTest method testRecoverableErrorThrownToConsumer.
@Test
public void testRecoverableErrorThrownToConsumer() throws Exception {
thrown.expect(FanOutShardSubscriber.RecoverableFanOutSubscriberException.class);
thrown.expectMessage("io.netty.handler.timeout.ReadTimeoutException");
SubscriptionErrorKinesisV2 errorKinesisV2 = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(ReadTimeoutException.INSTANCE);
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 org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SubscriptionErrorKinesisV2 in project flink by apache.
the class FanOutRecordPublisherTest method testShardConsumerCompletesIfResourceNotFoundExceptionThrownFromSubscription.
@Test
public void testShardConsumerCompletesIfResourceNotFoundExceptionThrownFromSubscription() throws Exception {
ResourceNotFoundException exception = ResourceNotFoundException.builder().build();
SubscriptionErrorKinesisV2 kinesis = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(exception);
RecordPublisher recordPublisher = createRecordPublisher(kinesis);
TestConsumer consumer = new TestConsumer();
assertEquals(COMPLETE, recordPublisher.run(consumer));
// Will exit on the first subscription
assertEquals(1, kinesis.getNumberOfSubscribeToShardInvocations());
}
use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.SubscriptionErrorKinesisV2 in project flink by apache.
the class FanOutShardSubscriberTest method testMultipleErrorsThrownPassesFirstErrorToConsumer.
@Test
public void testMultipleErrorsThrownPassesFirstErrorToConsumer() throws Exception {
thrown.expect(FanOutShardSubscriber.FanOutSubscriberException.class);
thrown.expectMessage("Error 1!");
RuntimeException error1 = new RuntimeException("Error 1!");
RuntimeException error2 = new RuntimeException("Error 2!");
SubscriptionErrorKinesisV2 errorKinesisV2 = FakeKinesisFanOutBehavioursFactory.errorDuringSubscription(error1, error2);
FanOutShardSubscriber subscriber = new FanOutShardSubscriber("consumerArn", "shardId", errorKinesisV2, DEFAULT_SUBSCRIBE_TO_SHARD_TIMEOUT);
StartingPosition startingPosition = StartingPosition.builder().build();
subscriber.subscribeToShardAndConsumeRecords(startingPosition, event -> {
});
}
Aggregations