use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar in project flink by apache.
the class StreamConsumerRegistrarUtilTest method testDeregisterStreamConsumersOnlyDeregistersEFOLazilyInitializedConsumers.
@Test
public void testDeregisterStreamConsumersOnlyDeregistersEFOLazilyInitializedConsumers() {
Properties configProps = getDefaultConfiguration();
configProps.setProperty(RECORD_PUBLISHER_TYPE, EFO.name());
configProps.put(EFO_REGISTRATION_TYPE, EAGER.name());
List<String> streams = Arrays.asList("stream-1");
StreamConsumerRegistrar registrar = mock(StreamConsumerRegistrar.class);
StreamConsumerRegistrarUtil.deregisterStreamConsumers(registrar, configProps, streams);
verifyZeroInteractions(registrar);
}
use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar in project flink by apache.
the class StreamConsumerRegistrarUtilTest method testDeregisterStreamConsumersMissingStreamArn.
@Test
public void testDeregisterStreamConsumersMissingStreamArn() throws Exception {
Properties configProps = getDefaultConfiguration();
configProps.setProperty(RECORD_PUBLISHER_TYPE, EFO.name());
List<String> streams = Arrays.asList("stream-1", "stream-2");
StreamConsumerRegistrar registrar = mock(StreamConsumerRegistrar.class);
StreamConsumerRegistrarUtil.deregisterStreamConsumers(registrar, configProps, streams);
verify(registrar).deregisterStreamConsumer("stream-1");
verify(registrar).deregisterStreamConsumer("stream-2");
}
use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar in project flink by apache.
the class StreamConsumerRegistrarUtilTest method testRegisterStreamConsumers.
@Test
public void testRegisterStreamConsumers() throws Exception {
Properties configProps = getDefaultConfiguration();
StreamConsumerRegistrar registrar = mock(StreamConsumerRegistrar.class);
when(registrar.registerStreamConsumer("stream-1", "consumer-name")).thenReturn("stream-1-consumer-arn");
when(registrar.registerStreamConsumer("stream-2", "consumer-name")).thenReturn("stream-2-consumer-arn");
StreamConsumerRegistrarUtil.registerStreamConsumers(registrar, configProps, Arrays.asList("stream-1", "stream-2"));
assertEquals("stream-1-consumer-arn", configProps.getProperty(efoConsumerArn("stream-1")));
assertEquals("stream-2-consumer-arn", configProps.getProperty(efoConsumerArn("stream-2")));
}
use of org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar in project flink by apache.
the class StreamConsumerRegistrarUtil method createStreamConsumerRegistrar.
private static StreamConsumerRegistrar createStreamConsumerRegistrar(final Properties configProps, final List<String> streams) {
FullJitterBackoff backoff = new FullJitterBackoff();
FanOutRecordPublisherConfiguration configuration = new FanOutRecordPublisherConfiguration(configProps, streams);
KinesisProxyV2Interface kinesis = KinesisProxyV2Factory.createKinesisProxyV2(configProps);
return new StreamConsumerRegistrar(kinesis, configuration, backoff);
}
Aggregations