How it works...

In summary, we did the following in this recipe:

  1. Created a Lambda function with basic Lambda permissions and Kinesis-specific permissions
  2. Invoked Lambda with a payload as required by the input handler object (Request.java)
  3. Verified that data was posted to the stream

From the Kinesis client, we retrieved DescribeStreamResult and from the DescribeStreamResult, we retrieved StreamDescription. The StreamDescription contains current status of the stream, the stream ARN, an array of shard objects of the stream, and information on whether there are more shards available. This was an optional step just to see the stream status.

The Kinesis client's putRecords method accepts a PutRecordsRequest object and the PutRecordsRequest object accepts a list of PutRecordsRequestEntry objects. We generated PutRecordsRequestEntry objects in a for loop and added them into a list. Once the list size crossed our defined batch size, we invoked the putRecords method of the Kinesis client and passed a PutRecordsRequest object with our list of PutRecordsRequestEntry objects.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.66