Interface ErrorHandler<ErrorT,OutputT extends POutput>
- Type Parameters:
ErrorT
- The type of the error object. This will usually be aBadRecord
, but can be any typeOutputT
- The return type of the sink PTransform.Usage of Error Handlers:
Simple usage with one DLQ
Usage with multiple DLQ stagesPCollection<?> records = ...; try (BadRecordErrorHandler<T> errorHandler = pipeline.registerBadRecordErrorHandler(SomeSink.write())) { PCollection<?> results = records.apply(SomeIO.write().withErrorHandler(errorHandler)); } results.apply(SomeOtherTransform);
This is marked as serializable despite never being needed on the runner, to enable it to be a parameter of an Autovalue configured PTransform.PCollection<?> records = ...; try (BadRecordErrorHandler<T> errorHandler = pipeline.registerBadRecordErrorHandler(SomeSink.write())) { PCollection<?> results = records.apply(SomeIO.write().withErrorHandler(errorHandler)) .apply(OtherTransform.builder().withErrorHandler(errorHandler)); } results.apply(SomeOtherTransform);
- All Superinterfaces:
AutoCloseable
,Serializable
- All Known Implementing Classes:
ErrorHandler.BadRecordErrorHandler
,ErrorHandler.DefaultErrorHandler
,ErrorHandler.PTransformErrorHandler
An Error Handler is a utility object used for plumbing error PCollections to a configured sink
Error Handlers must be closed before a pipeline is run to properly pipe error collections to the
sink, and the pipeline will be rejected if any handlers aren't closed.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static class
A default, placeholder error handler that exists to allow usage of .addErrorCollection() without effects.static class
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorCollection
(PCollection<ErrorT> errorCollection) boolean
isClosed()
Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
addErrorCollection
-
isClosed
boolean isClosed() -
getOutput
-