-
Notifications
You must be signed in to change notification settings - Fork 10
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
Raise when any records are invalid #394
base: main
Are you sure you want to change the base?
Conversation
@@ -216,7 +216,7 @@ abstract class Producer[F[_], PutReq, PutRes] private[kinesis4cats] ( | |||
) | |||
)(ref.get.flatMap(x => _put(x.inputRecords, x.retrying))) | |||
_ <- | |||
if (finalRes.hasFailed) { | |||
if (finalRes.hasErrors) { |
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.
This is a change in behaviour. Before, you would only see invalid
records if there was at least one failed
record also. Does this change align with the documentation?
kinesis4cats/docs/smithy4s/getting-started.md
Line 149 in 0e08701
A user can configure the producer to raise an exception if any of the error paths are detected (including partially failed records). |
kinesis4cats/shared/src/main/scala/kinesis4cats/producer/Producer.scala
Lines 370 to 373 in 0e08701
* @param raiseOnFailures | |
* If true, an exception will be raised if a | |
* [[kinesis4cats.producer.Producer.Error Producer.Error]] is detected in | |
* one of the batches |
Appreciate the PR, though I don't know if this is something we want to do. Raising an error on the I/O to Kinesis is what is important here. The return type of the |
Thanks for the feedback—I completely understand your point. My only concern here is that, if all records are invalid, the producer will not surface any error, which could be a bit unexpected from a user perspective, because invalid records are currently raised if there is also a failure in the batch. Just wanted to bring that up in case it aligns with the intended design. |
Sorry for the long wait on this one. I see what you mean - this would only be done if configured. Makes sense. |
} | ||
|
||
fixture(true).test( | ||
fixture(aggregate = true, raiseOnFailures = true).test( |
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.
fixture(aggregate = true, raiseOnFailures = true).test( | |
fixture(aggregate = true, raiseOnFailures = false).test( |
I think we want this as false, yes?
Changes Introduced
Raise error when there is at least one
invalid
record. Previously it was only raising when there was at least onefailed
record.Applicable linked issues
Checklist (check all that apply)