Add forward_to support along with failure_pipeline support for kafka sink#6778
Open
graytaylor0 wants to merge 1 commit intoopensearch-project:mainfrom
Open
Add forward_to support along with failure_pipeline support for kafka sink#6778graytaylor0 wants to merge 1 commit intoopensearch-project:mainfrom
graytaylor0 wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
…sink Signed-off-by: Taylor Gray <tylgry@amazon.com>
dlvenable
requested changes
Apr 27, 2026
| } | ||
| } else { | ||
| releaseEventHandles(true); | ||
| if (sinkContext != null && sinkForwardRecordsContext != null && sinkContext.getForwardToPipelines().size() > 0) { |
Member
There was a problem hiding this comment.
Should we need this?
&& sinkContext.getForwardToPipelines().size() > 0
Why would we get a SinkForwardRecordsContext if there is no pipeline to forward to?
| callbackArgumentCaptor.getValue().onCompletion(null, new RuntimeException("kafka error")); | ||
|
|
||
| verify(numberOfRecordProcessingError).increment(); | ||
| verify(failurePipeline).sendEvents(any()); |
| verify(kafkaProducer).send(any(ProducerRecord.class), callbackArgumentCaptor.capture()); | ||
| callbackArgumentCaptor.getValue().onCompletion(mock(org.apache.kafka.clients.producer.RecordMetadata.class), null); | ||
|
|
||
| verify(sinkContext, org.mockito.Mockito.never()).forwardRecords(any(), any(), any()); |
Member
There was a problem hiding this comment.
Do we need a fully-qualified import?
|
|
||
| verify(failurePipeline).sendEvents(any()); | ||
| verify(failureMetadata).withPluginName("kafka"); | ||
| verify(failureMetadata).with("topic", "test-topic"); |
| } else { | ||
| releaseEventHandles(true); | ||
| if (sinkContext != null && sinkForwardRecordsContext != null && sinkContext.getForwardToPipelines().size() > 0) { | ||
| sinkForwardRecordsContext.addRecord(originalRecord); |
Member
There was a problem hiding this comment.
I thought that the OpenSearch sink forwards the OpenSearch document. Do we want to be consistent with that? This would be a little odd in this sink since it might be JSON or binary data. But it would retain some consistency.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change enables support for
forward_tooption for the kafka sink, as well as configuring afailure_pipeline.Tested by running data prepper and verifying events are forwarded to correct sub-pipeline on success, and routed to failure-pipeline on failure to write to msk.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.