Created
September 8, 2015 09:45
-
-
Save mjgp2/81a82512aaba08a6ddee to your computer and use it in GitHub Desktop.
A snippet of how to use kinesis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment