Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We propose the following new public interface:

package: `org.apache.kafka.connect.reporter;`

Code Block
languagejava
/**
 * Provides a mechanism for reporting errors
 * using the information contained in an `ErrorContext`.
 *
 * @param <T> the type of the error context
 */
public interface ErrorRecordReporter<T> extends Configurable, AutoCloseable {

	/**
	 * Report an error using the provided error context.
	 *
	 * @param context the error context (cannot be null)
	 */
	void report(ErrorContext<T> context);

	@Override
	default void close() {
	}
}

package: `org.apache.kafka.connect.reporter;`

Code Block
languagejava
public class ErrorContext<T> {

	private final String stage;
	private final String executingClassName;
	private final T original;
	private final Throwable error;

	public ErrorContext(String stage, String executingClassName, T original, Throwable error) {
		this.stage = stage;
		this.executingClassName = executingClassName;
		this.original = original;
		this.error = error;
	}

	public String stage() {
		return stage;
	}

	public String executingClassName() {
		return executingClassName;
	}

	public T original() {
		return original;
	}

	public Throwable error() {
		return error;
	}

}

Additionally, we propose to add the following configuration properties.

...