Skip to content

Instantly share code, notes, and snippets.

@mjgp2
Created September 8, 2015 09:45
Show Gist options
  • Select an option

  • Save mjgp2/81a82512aaba08a6ddee to your computer and use it in GitHub Desktop.

Select an option

Save mjgp2/81a82512aaba08a6ddee to your computer and use it in GitHub Desktop.

Revisions

  1. mjgp2 created this gist Sep 8, 2015.
    19 changes: 19 additions & 0 deletions kinesis-snippet.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # (1) set up the client

    # where to get the access/secret key
    # see http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html
    AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain();

    ClientConfiguration clientConfig = new ClientConfiguration();
    AmazonKinesis kinesis = new AmazonKinesisClient(credentialsProvider, clientConfig);

    # what region you are in
    kinesis.setRegion(Region.getRegion(Regions.EU_WEST_1));

    # (2) send a put record

    PutRecordRequest putRecord = new PutRecordRequest();
    putRecord.setStreamName(streamName);
    putRecord.setPartitionKey(partitionKeyString);
    putRecord.setData(byteBuffer);
    kinesis.putRecord(putRecord);