Java源码示例:com.amazonaws.services.kinesis.AmazonKinesisAsyncClientBuilder
示例1
@Bean
public AmazonKinesisAsync amazonKinesis() {
// See https://github.com/mhart/kinesalite#cbor-protocol-issues-with-the-java-sdk
System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");
return AmazonKinesisAsyncClientBuilder.standard()
.withClientConfiguration(
new ClientConfiguration()
.withMaxErrorRetry(0)
.withConnectionTimeout(1000))
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration("http://localhost:" + DEFAULT_KINESALITE_PORT,
Regions.DEFAULT_REGION.getName()))
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", "")))
.build();
}
示例2
@Override
public AmazonKinesisAsync amazonKinesis() {
return decorateWithConfigsAndBuild(
AmazonKinesisAsyncClientBuilder.standard(),
LocalstackDocker::getEndpointKinesis
);
}
示例3
@Bean
@ConditionalOnMissingBean
public AmazonKinesisAsync amazonKinesis() {
return AmazonKinesisAsyncClientBuilder.standard()
.withCredentials(this.awsCredentialsProvider)
.withRegion(this.region)
.build();
}
示例4
public static AmazonKinesisAsync getClientKinesisAsync() {
AmazonKinesisAsyncClientBuilder amazonKinesisAsyncClientBuilder =
AmazonKinesisAsyncClientBuilder.standard()
.withEndpointConfiguration(
createEndpointConfiguration(LocalstackDocker.INSTANCE::getEndpointKinesis));
return applyConfigurationAndBuild(amazonKinesisAsyncClientBuilder);
}
示例5
AmazonKinesisAsync get() {
if (asyncClient == null) {
synchronized (this) {
if (asyncClient != null) return asyncClient;
AmazonKinesisAsyncClientBuilder builder = AmazonKinesisAsyncClientBuilder.standard()
.withCredentials(credentialsProvider)
.withEndpointConfiguration(endpointConfiguration);
if (region != null) builder.withRegion(region);
asyncClient = builder.build();
}
}
return asyncClient;
}