reactor-core/src/main/java/reactor/core/publisher/Operators.java
public static <T> void onDiscard(@Nullable T element, Context context) {
		Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_DISCARD, null);
		if (element != null && hook != null) {
			try {
				hook.accept(element);
			}
			catch (Throwable t) {
				log.warn("Error in discard hook", t);
			}
		}
	}
public static <T> void onDiscard(@Nullable T element, Context context) {
		Consumer<Object> hook = context.getOrDefault(Hooks.KEY_ON_DISCARD, null);
		if (element != null && hook != null) {
			try {
				hook.accept(element);
			}
			catch (Throwable t) {
				log.warn("Error in discard hook", t);
			}
		}
	}
Invoke a (local or global) hook that processes elements that get discarded. This
includes elements that are dropped (for malformed sources), but also filtered out
(eg. not passing a {@code filter()} predicate).
<p>
For elements that are buffered or enqueued, but subsequently discarded due to
cancellation or error, see {@link #onDiscardMultiple(Stream, Context)} and
{@link #onDiscardQueueWithClear(Queue, Context, Function)}.

@param element the element that is being discarded
@param context the context in which to look for a local hook
@param <T> the type of the element
@see #onDiscardMultiple(Stream, Context)
@see #onDiscardMultiple(Collection, Context)
@see #onDiscardQueueWithClear(Queue, Context, Function)