use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher in project flink by apache.
the class FanOutRecordPublisherTest method testToSdkV2StartingPositionTrimHorizon.
@Test
public void testToSdkV2StartingPositionTrimHorizon() throws Exception {
SingleShardFanOutKinesisV2 kinesis = emptyShard();
RecordPublisher publisher = createRecordPublisher(kinesis, StartingPosition.continueFromSequenceNumber(SENTINEL_EARLIEST_SEQUENCE_NUM.get()));
publisher.run(new TestConsumer());
assertNull(kinesis.getStartingPositionForSubscription(0).sequenceNumber());
assertEquals(TRIM_HORIZON, kinesis.getStartingPositionForSubscription(0).type());
}
use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher 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 org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher 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.internals.publisher.RecordPublisher in project flink by apache.
the class FanOutRecordPublisherTest method testExceptionThrownInConsumerPropagatesToRecordPublisher.
@Test
public void testExceptionThrownInConsumerPropagatesToRecordPublisher() throws Exception {
thrown.expect(RuntimeException.class);
thrown.expectMessage("An error thrown from the consumer");
SingleShardFanOutKinesisV2 kinesis = FakeKinesisFanOutBehavioursFactory.boundedShard().build();
RecordPublisher recordPublisher = createRecordPublisher(kinesis);
recordPublisher.run(batch -> {
throw new RuntimeException("An error thrown from the consumer");
});
}
use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.RecordPublisher in project flink by apache.
the class FanOutRecordPublisherTest method testResourceNotFoundWhenObtainingSubscriptionTerminatesApplication.
@Test
public void testResourceNotFoundWhenObtainingSubscriptionTerminatesApplication() throws Exception {
thrown.expect(ResourceNotFoundException.class);
KinesisProxyV2Interface kinesis = FakeKinesisFanOutBehavioursFactory.resourceNotFoundWhenObtainingSubscription();
RecordPublisher recordPublisher = createRecordPublisher(kinesis);
recordPublisher.run(new TestConsumer());
}
Aggregations