forked from opensearch-project/data-prepper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of Pipeline DLQ
Signed-off-by: Kondaka <[email protected]>
- Loading branch information
Showing
27 changed files
with
178 additions
and
44 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
data-prepper-api/src/main/java/org/opensearch/dataprepper/model/PipelineIf.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.model; | ||
|
||
import org.opensearch.dataprepper.model.source.Source; | ||
|
||
public interface PipelineIf { | ||
Source getSource(); | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
...-prepper-api/src/main/java/org/opensearch/dataprepper/model/failures/FailurePipeline.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.model.failures; | ||
|
||
import org.opensearch.dataprepper.model.event.Event; | ||
import org.opensearch.dataprepper.model.record.Record; | ||
|
||
import java.util.Collection; | ||
public interface FailurePipeline { | ||
void sendFailedEvents(Collection<Record<Event>> events); | ||
} | ||
|
||
|
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
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
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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
...er-core/src/main/java/org/opensearch/dataprepper/core/pipeline/FailurePipelineSource.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.core.pipeline; | ||
|
||
import org.opensearch.dataprepper.model.source.Source; | ||
import org.opensearch.dataprepper.model.failures.FailurePipeline; | ||
import org.opensearch.dataprepper.model.record.Record; | ||
import org.opensearch.dataprepper.model.event.Event; | ||
import org.opensearch.dataprepper.model.buffer.Buffer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
public class FailurePipelineSource implements Source<Record<Event>>, FailurePipeline { | ||
private static final Logger LOG = LoggerFactory.getLogger(FailurePipelineSource.class); | ||
private static final int DEFAULT_WRITE_TIMEOUT = Integer.MAX_VALUE; | ||
private Buffer buffer; | ||
private AtomicBoolean isStopRequested; | ||
|
||
public FailurePipelineSource() { | ||
isStopRequested = new AtomicBoolean(false); | ||
} | ||
|
||
@Override | ||
public void start(Buffer buffer) { | ||
this.buffer = buffer; | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
isStopRequested.set(true); | ||
} | ||
|
||
@Override | ||
public void sendFailedEvents(Collection<Record<Event>> records) { | ||
try { | ||
buffer.writeAll(records, DEFAULT_WRITE_TIMEOUT); | ||
} catch (Exception e) { | ||
LOG.error("Failed to write to failure pipeline"); | ||
} | ||
} | ||
|
||
} |
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
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
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
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
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
Oops, something went wrong.