elsa v0.12.3 Elsa.Producer

Defines functions to write messages to topics based on either a list of endpoints or a named client. All produce functions support the following options:

  • An existing named client process to handle the request can be specified by the keyword option connection:.
  • If no partition is supplied, the first (zero) partition is chosen.
  • Value may be a single message or a list of messages.
  • If a list of messages is supplied as the value, the key is defaulted to an empty string binary.
  • Partition can be specified by the keyword option partition: and an integer corresponding to a specific partition, or the keyword option partitioner: and the atoms :md5 or :random. The atoms correspond to partitioner functions that will uniformely select a random partition from the total available topic partitions or assign an integer based on an md5 hash of the messages.

Link to this section Summary

Functions

Write the supplied message(s) to the desired topic/partition via an endpoint list and optional named client. If no client is supplied, the default named client is chosen.

Link to this section Functions

Link to this function

produce(endpoints_or_connection, topic, messages, opts \\ [])

produce(
  Elsa.endpoints() | Elsa.connection(),
  Elsa.topic(),
  {term(), term()} | term() | [{term(), term()}] | [term()],
  keyword()
) ::
  :ok | {:error, term()} | {:error, String.t(), [Elsa.Message.elsa_message()]}

Write the supplied message(s) to the desired topic/partition via an endpoint list and optional named client. If no client is supplied, the default named client is chosen.

Link to this function

ready?(connection)