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());
}
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);
}
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));
}
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));
}
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);
}
Aggregations