Skip to content

Commit

Permalink
docs: add documentation for format_discarded/2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziinc committed Nov 28, 2024
1 parent fa429ba commit d109576
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/broadway.ex
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,21 @@ defmodule Broadway do
@callback process_name(broadway_name :: Broadway.name(), base_name :: String.t()) ::
Broadway.name()

@optional_callbacks prepare_messages: 2, handle_batch: 4, handle_failed: 2, process_name: 2
@doc """
Invoked when items are discarded from the buffer. Gets passed to `GenStage.format_discarded/2`.
If true is returned by the callback, the default log message is emitted.
Allows controlling or customization of the log message emitted.
"""
@doc since: "1.2.0"
@callback format_discarded(discarded :: non_neg_integer(), state :: term()) :: boolean()

@optional_callbacks prepare_messages: 2,
handle_batch: 4,
handle_failed: 2,
process_name: 2,
format_discarded: 2

defguardp is_broadway_name(name)
when is_atom(name) or (is_tuple(name) and tuple_size(name) == 3)
Expand Down

0 comments on commit d109576

Please sign in to comment.