elsa v0.5.0 Elsa.Fetch

Provides functions for doing one-off retrieval of messages from the Kafka cluster.

Link to this section Summary

Functions

A simple interface for quickly retrieving a message set from the cluster on the given topic. Partition and offset may be specified as keyword options, defaulting to 0 in both cases if either is not supplied by the caller.

Retrieves all messages on a given topic across all partitions by default. Evaluates lazily, returning a Stream resource containing the messages. By default the starting offset is the earliest message offset and fetching continues until the latest offset at the time the stream is instantiated. Refine the scope of stream fetch by passing the start_offset and end_offset keyword arguments.

Retrieves a stream of messages containing the supplied search string. Search can be limited by an offset which is passed through to fetch_stream/3 call retrieving the messages to search. By default, the search is applied against the message values but can be optionally switched to search on the message key by supplying the search_by_key: true option. All options for fetch_stream/3 are respected for restricting the search scope.

Link to this section Functions

Link to this function

fetch(endpoints, topic, opts \\ [])
fetch(keyword(), String.t(), keyword()) ::
  {:ok, integer(), [tuple()]} | {:error, term()}

A simple interface for quickly retrieving a message set from the cluster on the given topic. Partition and offset may be specified as keyword options, defaulting to 0 in both cases if either is not supplied by the caller.

Link to this function

fetch_stream(endpoints, topic, opts \\ [])
fetch_stream(keyword(), String.t(), keyword()) :: Enumerable.t()

Retrieves all messages on a given topic across all partitions by default. Evaluates lazily, returning a Stream resource containing the messages. By default the starting offset is the earliest message offset and fetching continues until the latest offset at the time the stream is instantiated. Refine the scope of stream fetch by passing the start_offset and end_offset keyword arguments.

Link to this function

search(endpoints, topic, search_term, opts \\ [])
search(keyword(), String.t(), String.t(), keyword()) :: Enumerable.t()

Retrieves a stream of messages containing the supplied search string. Search can be limited by an offset which is passed through to fetch_stream/3 call retrieving the messages to search. By default, the search is applied against the message values but can be optionally switched to search on the message key by supplying the search_by_key: true option. All options for fetch_stream/3 are respected for restricting the search scope.