Class WithFailures.ExceptionAsMapHandler<T>

All Implemented Interfaces:
Serializable, HasDisplayData, ProcessFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>, SerializableFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>
Enclosing class:
WithFailures

public static class WithFailures.ExceptionAsMapHandler<T> extends SimpleFunction<WithFailures.ExceptionElement<T>,KV<T,Map<String,String>>>
A simple handler that extracts information from an exception to a Map<String, String> and returns a KV where the key is the input element that failed processing, and the value is the map of exception attributes.

Extends SimpleFunction so that full type information is captured. Map and KV coders are well supported by Beam, so coder inference can be successfully applied if the consuming transform passes type information to the failure collection's TupleTag.

The keys populated in the map are "className", "message", and "stackTrace" of the exception.

See Also: