elsa v0.8.1 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
name:
. - 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.
- If message value is a list, it is expected to be a list of key/value tuples.
- Partition can be specified by the keyword option
partition:
and an integer corresponding to a specific partition, or the keyword optionpartitioner:
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 as a one-off operation. Following the completion of the operation, the producer is stopped. If no client is supplied, the default named client is chosen.
Write the supplied messages to the desired topic/partition via a named client specified as a keyword
option (via the name:
key). Messages may be a single message or a list of messages.
Link to this section Types
endpoints()
hostname()
portnum()
portnum() :: pos_integer()
portnum() :: pos_integer()
topic()
topic() :: String.t()
topic() :: String.t()
Link to this section Functions
produce(endpoints, topic, messages, opts \\ [])
Write the supplied message(s) to the desired topic/partition via an endpoint list and optional named client as a one-off operation. Following the completion of the operation, the producer is stopped. If no client is supplied, the default named client is chosen.
produce_sync(topic, messages, opts \\ [])
Write the supplied messages to the desired topic/partition via a named client specified as a keyword
option (via the name:
key). Messages may be a single message or a list of messages.