Search in sources :

Example 6 with KinesisClient

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

the class CreateDataStream 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();
    createStream(kinesisClient, streamName);
    System.out.println("Done");
    kinesisClient.close();
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 7 with KinesisClient

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

the class StockTradesWriter 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 to which records are written (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();
    // Ensure that the Kinesis Stream is valid
    validateStream(kinesisClient, streamName);
    setStockData(kinesisClient, streamName);
    kinesisClient.close();
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 8 with KinesisClient

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

the class GetRecords 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 to read from (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();
    getStockTrades(kinesisClient, streamName);
    kinesisClient.close();
}
Also used : KinesisClient(software.amazon.awssdk.services.kinesis.KinesisClient) Region(software.amazon.awssdk.regions.Region)

Example 9 with KinesisClient

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

the class ListShards 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];
    // snippet-start:[kinesis.java2.ListShards.client]
    Region region = Region.US_EAST_1;
    KinesisClient kinesisClient = KinesisClient.builder().region(region).build();
    // snippet-end:[kinesis.java2.ListShards.client]
    listKinShards(kinesisClient, name);
    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