Search in sources :

Example 6 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class AWSGeneralUtilTest method testCreateNettyAsyncHttpClientReadTimeout.

@Test
public void testCreateNettyAsyncHttpClientReadTimeout() throws Exception {
    Duration readTimeout = Duration.ofMillis(1234);
    AttributeMap clientConfiguration = AttributeMap.builder().put(SdkHttpConfigurationOption.READ_TIMEOUT, readTimeout).build();
    NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
    SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(clientConfiguration, builder);
    NettyConfiguration nettyConfiguration = TestUtil.getNettyConfiguration(httpClient);
    assertEquals(readTimeout.toMillis(), nettyConfiguration.readTimeoutMillis());
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) NettyNioAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient) NettyConfiguration(software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration) Duration(java.time.Duration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Test(org.junit.Test)

Example 7 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class KinesisProxyV2Factory method createKinesisProxyV2.

/**
 * Uses the given properties to instantiate a new instance of {@link KinesisProxyV2}.
 *
 * @param configProps the properties used to parse configuration
 * @return the Kinesis proxy
 */
public static KinesisProxyV2Interface createKinesisProxyV2(final Properties configProps) {
    Preconditions.checkNotNull(configProps);
    final AttributeMap convertedProperties = AwsV2Util.convertProperties(configProps);
    final AttributeMap.Builder clientConfiguration = AttributeMap.builder();
    populateDefaultValues(clientConfiguration);
    final SdkAsyncHttpClient httpClient = AWSGeneralUtil.createAsyncHttpClient(convertedProperties.merge(clientConfiguration.build()), NettyNioAsyncHttpClient.builder());
    final FanOutRecordPublisherConfiguration configuration = new FanOutRecordPublisherConfiguration(configProps, emptyList());
    Properties legacyConfigProps = new Properties(configProps);
    legacyConfigProps.setProperty(KinesisDataStreamsConfigConstants.KINESIS_CLIENT_USER_AGENT_PREFIX, AWSAsyncSinkUtil.formatFlinkUserAgentPrefix(KinesisDataStreamsConfigConstants.BASE_KINESIS_USER_AGENT_PREFIX_FORMAT));
    final KinesisAsyncClient client = AWSAsyncSinkUtil.createAwsAsyncClient(legacyConfigProps, httpClient, KinesisAsyncClient.builder(), KinesisDataStreamsConfigConstants.BASE_KINESIS_USER_AGENT_PREFIX_FORMAT, KinesisDataStreamsConfigConstants.KINESIS_CLIENT_USER_AGENT_PREFIX);
    return new KinesisProxyV2(client, httpClient, configuration, BACKOFF);
}
Also used : KinesisAsyncClient(software.amazon.awssdk.services.kinesis.KinesisAsyncClient) AttributeMap(software.amazon.awssdk.utils.AttributeMap) FanOutRecordPublisherConfiguration(org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherConfiguration) SdkAsyncHttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient) Properties(java.util.Properties)

Example 8 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class AwsV2UtilTest method testConvertReadTimeout.

@Test
public void testConvertReadTimeout() {
    Duration readTimeout = Duration.ofMillis(1234);
    Properties properties = new Properties();
    properties.setProperty(EFO_HTTP_CLIENT_READ_TIMEOUT_MILLIS, String.valueOf(readTimeout.toMillis()));
    AttributeMap convertedProperties = AwsV2Util.convertProperties(properties);
    assertEquals(readTimeout, convertedProperties.get(SdkHttpConfigurationOption.READ_TIMEOUT));
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) Duration(java.time.Duration) Properties(java.util.Properties) Test(org.junit.Test)

Example 9 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class AwsV2UtilTest method testConvertMaxConcurrency.

@Test
public void testConvertMaxConcurrency() {
    Integer maxConcurrency = 5;
    Properties properties = new Properties();
    properties.setProperty(EFO_HTTP_CLIENT_MAX_CONCURRENCY, maxConcurrency.toString());
    AttributeMap convertedProperties = AwsV2Util.convertProperties(properties);
    assertEquals(maxConcurrency, convertedProperties.get(SdkHttpConfigurationOption.MAX_CONNECTIONS));
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with AttributeMap

use of software.amazon.awssdk.utils.AttributeMap in project flink by apache.

the class AwsV2UtilTest method testConvertEmpty.

@Test
public void testConvertEmpty() {
    Properties properties = new Properties();
    AttributeMap convertedProperties = AwsV2Util.convertProperties(properties);
    assertEquals(AttributeMap.empty(), convertedProperties);
}
Also used : AttributeMap(software.amazon.awssdk.utils.AttributeMap) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

AttributeMap (software.amazon.awssdk.utils.AttributeMap)14 Test (org.junit.Test)13 SdkAsyncHttpClient (software.amazon.awssdk.http.async.SdkAsyncHttpClient)11 NettyNioAsyncHttpClient (software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient)10 NettyConfiguration (software.amazon.awssdk.http.nio.netty.internal.NettyConfiguration)10 Duration (java.time.Duration)6 Properties (java.util.Properties)4 FanOutRecordPublisherConfiguration (org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutRecordPublisherConfiguration)1 Protocol (software.amazon.awssdk.http.Protocol)1 KinesisAsyncClient (software.amazon.awssdk.services.kinesis.KinesisAsyncClient)1