public static class WithFailures.ThrowableHandler<T> extends SimpleFunction<WithFailures.ExceptionElement<T>,KV<T,EncodableThrowable>>
Throwable
that led to the exception, returning it along
with the original value as a KV
.
Extends SimpleFunction
so that full type information is captured. KV
and
EncodableThrowable
coders can be easily inferred by Beam, so coder inference can be
successfully applied if the consuming transform passes type information to the failure
collection's TupleTag
. This may require creating an instance of an anonymous inherited
class rather than of this class directly.
Constructor and Description |
---|
ThrowableHandler() |
Modifier and Type | Method and Description |
---|---|
KV<T,EncodableThrowable> |
apply(WithFailures.ExceptionElement<T> f)
Returns the result of invoking this function on the given input.
|
fromSerializableFunctionWithOutputType
fromProcessFunctionWithOutputType, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData
public KV<T,EncodableThrowable> apply(WithFailures.ExceptionElement<T> f)
ProcessFunction
apply
in interface ProcessFunction<WithFailures.ExceptionElement<T>,KV<T,EncodableThrowable>>
apply
in interface SerializableFunction<WithFailures.ExceptionElement<T>,KV<T,EncodableThrowable>>
apply
in class SimpleFunction<WithFailures.ExceptionElement<T>,KV<T,EncodableThrowable>>