use of software.amazon.awssdk.services.kinesis.model.StartingPosition 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 -> {
});
}
use of software.amazon.awssdk.services.kinesis.model.StartingPosition in project flink by apache.
the class FanOutShardSubscriberTest method testTimeoutSubscribingToShard.
@Test
public void testTimeoutSubscribingToShard() throws Exception {
thrown.expect(FanOutShardSubscriber.RecoverableFanOutSubscriberException.class);
thrown.expectMessage("Timed out acquiring subscription");
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.failsToAcquireSubscription();
FanOutShardSubscriber subscriber = new FanOutShardSubscriber("consumerArn", "shardId", kinesis, Duration.ofMillis(1));
StartingPosition startingPosition = StartingPosition.builder().build();
subscriber.subscribeToShardAndConsumeRecords(startingPosition, event -> {
});
}
use of software.amazon.awssdk.services.kinesis.model.StartingPosition in project flink by apache.
the class FanOutShardSubscriberTest method testTimeoutEnqueuingEvent.
@Test
public void testTimeoutEnqueuingEvent() throws Exception {
thrown.expect(FanOutShardSubscriber.RecoverableFanOutSubscriberException.class);
thrown.expectMessage("Timed out enqueuing event SubscriptionNextEvent");
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.shardThatCreatesBackpressureOnQueue();
FanOutShardSubscriber subscriber = new FanOutShardSubscriber("consumerArn", "shardId", kinesis, DEFAULT_SUBSCRIBE_TO_SHARD_TIMEOUT, Duration.ofMillis(100));
StartingPosition startingPosition = StartingPosition.builder().build();
subscriber.subscribeToShardAndConsumeRecords(startingPosition, event -> {
try {
Thread.sleep(120);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
}
Aggregations