Search in sources :

Example 1 with ClientConfiguration

use of org.apache.beam.sdk.io.aws2.common.ClientConfiguration in project beam by apache.

the class KinesisSource method createClient.

private SimplifiedKinesisClient createClient(PipelineOptions options) {
    AwsOptions awsOptions = options.as(AwsOptions.class);
    KinesisClient kinesis;
    CloudWatchClient cloudWatch;
    if (spec.getAWSClientsProvider() != null) {
        kinesis = spec.getAWSClientsProvider().getKinesisClient();
        cloudWatch = spec.getAWSClientsProvider().getCloudWatchClient();
    } else {
        ClientConfiguration config = spec.getClientConfiguration();
        kinesis = ClientBuilderFactory.buildClient(awsOptions, KinesisClient.builder(), config);
        cloudWatch = ClientBuilderFactory.buildClient(awsOptions, CloudWatchClient.builder(), config);
    }
    return new SimplifiedKinesisClient(kinesis, cloudWatch, spec.getRequestRecordsLimit(), Instant::now);
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Instant(org.joda.time.Instant) KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) AwsOptions(org.apache.beam.sdk.io.aws2.options.AwsOptions) ClientConfiguration(org.apache.beam.sdk.io.aws2.common.ClientConfiguration)

Example 2 with ClientConfiguration

use of org.apache.beam.sdk.io.aws2.common.ClientConfiguration in project beam by apache.

the class SqsUnboundedReader method initClient.

private void initClient() {
    if (sqsClient == null) {
        if (source.getRead().sqsClientProvider() != null) {
            // build client using legacy SqsClientProvider
            sqsClient = source.getRead().sqsClientProvider().getSqsClient();
        } else {
            ClientConfiguration config = source.getRead().clientConfiguration();
            sqsClient = ClientBuilderFactory.buildClient(awsOptions, SqsClient.builder(), config);
        }
    }
}
Also used : ClientConfiguration(org.apache.beam.sdk.io.aws2.common.ClientConfiguration)

Aggregations

ClientConfiguration (org.apache.beam.sdk.io.aws2.common.ClientConfiguration)2 AwsOptions (org.apache.beam.sdk.io.aws2.options.AwsOptions)1 Instant (org.joda.time.Instant)1 CloudWatchClient (software.amazon.awssdk.services.cloudwatch.CloudWatchClient)1 KinesisClient (software.amazon.awssdk.services.kinesis.KinesisClient)1