Search in sources :

Example 1 with StreamConsumerRegistrar

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);
}
Also used : StreamConsumerRegistrar(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar) Properties(java.util.Properties) Test(org.junit.Test)

Example 2 with StreamConsumerRegistrar

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");
}
Also used : StreamConsumerRegistrar(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar) Properties(java.util.Properties) Test(org.junit.Test)

Example 3 with StreamConsumerRegistrar

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")));
}
Also used : StreamConsumerRegistrar(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar) Properties(java.util.Properties) Test(org.junit.Test)

Example 4 with StreamConsumerRegistrar

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);
}
Also used : FanOutRecordPublisherConfiguration(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherConfiguration) StreamConsumerRegistrar(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar) KinesisProxyV2Interface(org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface) FullJitterBackoff(org.apache.flink.streaming.connectors.kinesis.proxy.FullJitterBackoff)

Aggregations

StreamConsumerRegistrar (org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.StreamConsumerRegistrar)4 Properties (java.util.Properties)3 Test (org.junit.Test)3 FanOutRecordPublisherConfiguration (org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherConfiguration)1 FullJitterBackoff (org.apache.flink.streaming.connectors.kinesis.proxy.FullJitterBackoff)1 KinesisProxyV2Interface (org.apache.flink.streaming.connectors.kinesis.proxy.KinesisProxyV2Interface)1