Search in sources :

Example 1 with KinesisClient

use of software.amazon.awssdk.services.kinesis.KinesisClient 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 KinesisClient

use of software.amazon.awssdk.services.kinesis.KinesisClient in project aws-doc-sdk-examples by awsdocs.

the class DeleteDataStream method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <streamName>\n\n" + "Where:\n" + "    streamName - The Amazon Kinesis data stream (for example, StockTradeStream)\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String streamName = args[0];
    Region region = Region.US_EAST_1;
    KinesisClient kinesisClient = KinesisClient.builder().region(region).build();
    deleteStream(kinesisClient, streamName);
    kinesisClient.close();
    System.out.println("Done");
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 3 with KinesisClient

use of software.amazon.awssdk.services.kinesis.KinesisClient in project aws-doc-sdk-examples by awsdocs.

the class AddDataShards method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <streamName>\n\n" + "Where:\n" + "    streamName - The Amazon Kinesis data stream (for example, StockTradeStream)\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String name = args[0];
    String inputShards = "2";
    int goalShards = Integer.parseInt(inputShards);
    // snippet-start:[kinesis.java2.AddDataShards.client]
    Region region = Region.US_EAST_1;
    KinesisClient kinesisClient = KinesisClient.builder().region(region).build();
    // snippet-end:[kinesis.java2.AddDataShards.client]
    addShards(kinesisClient, name, goalShards);
    kinesisClient.close();
    System.out.println("Done");
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 4 with KinesisClient

use of software.amazon.awssdk.services.kinesis.KinesisClient in project aws-doc-sdk-examples by awsdocs.

the class DescribeLimits method main.

public static void main(String[] args) {
    // snippet-start:[kinesis.java2.DescribeLimits.client]
    Region region = Region.US_EAST_1;
    KinesisClient kinesisClient = KinesisClient.builder().region(region).build();
    // snippet-end:[kinesis.java2.DescribeLimits.client]
    describeKinLimits(kinesisClient);
    kinesisClient.close();
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 5 with KinesisClient

use of software.amazon.awssdk.services.kinesis.KinesisClient in project aws-doc-sdk-examples by awsdocs.

the class RegisterStreamConsumer method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <streamARN>\n\n" + "Where:\n" + "    streamARN - The Amazon Kinesis data stream (for example, arn:aws:kinesis:us-east-1:814548xxxxxx:stream/LamDataStream)\n\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String streamARN = args[0];
    Region region = Region.US_EAST_1;
    KinesisClient kinesisClient = KinesisClient.builder().region(region).build();
    String arnValue = regConsumer(kinesisClient, streamARN);
    System.out.println(arnValue);
    kinesisClient.close();
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Aggregations

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