-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kinesis putrecords sampler #4
base: main
Are you sure you want to change the base?
Conversation
Send set of records to Kinesis stream
@JoseLuisSR If you don't have any concerns, can you kindly merge this? |
@JoseLuisSR Bumping this up |
try { | ||
putRecordsRequestEntryList.add(PutRecordsRequestEntry.builder() | ||
.data(SdkBytes.fromByteArray(String.valueOf(jsonArray.get(i)).getBytes(StandardCharsets.UTF_8))) | ||
.partitionKey(context.getParameter(KINESIS_PARTITION_KEY) + "-" + i).build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each record could specify the Data, ExplicitHashKey, and Partition Key.
Could you please get these fields from the JSON and use them to build PutReecordsRequestEntry.
JSONArray jsonArray = new JSONArray(tempPayload); | ||
List<PutRecordsRequestEntry> putRecordsRequestEntryList = new ArrayList<>(); | ||
PutRecordsRequest putRecordsRequest = null; | ||
for (int i = 0; i < jsonArray.length(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The limit of records is 500.
Please add validation to not exceed this limit.
} catch (JSONException e) { | ||
e.printStackTrace(); | ||
} | ||
putRecordsRequest = PutRecordsRequest.builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are building PutRecordRequest for each record in the array.
I guess is better to create PutRecordRequest once with the List<PutRecordsRequestEntry and streamName.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @samarr
Thank you to send it PR.
I agree with you to create another Java Sampler to produce put records on Kinesis Data Stream.
I suggested some changes to improve the solution.
Please let me know if you have doubts.
Have created a Kinesis put records sampler as per the request - #3. Please check and share any feedback you have.