View Source Elsa.Message (Elsa.fi v2.0.2)

Defines the structure of a Kafka message provided by the Elsa library and the function to construct the message struct.

Link to this section Summary

Functions

Constructs a message struct from the imported definition of a kafka_message as defined by the brod library with the addition of the topic and partition the message was read from as well as the optional generation id as defined by the message's relationship to a consumer group. Generation id defaults to nil in the event the message retrieved outside of the context of a consumer group.

Link to this section Types

@type elsa_message() :: %Elsa.Message{
  generation_id: integer() | nil,
  headers: list(),
  key: term(),
  offset: integer(),
  partition: Elsa.partition(),
  timestamp: term(),
  topic: Elsa.topic(),
  value: term()
}
@type kafka_message() ::
  {:kafka_message, offset :: integer(), key :: term(), value :: term(),
   ts_type :: term(), ts :: integer(), headers :: term()}

Link to this section Functions

Link to this macro

kafka_message(args \\ [])

View Source (macro)
Link to this macro

kafka_message(record, args)

View Source (macro)
@spec new(
  kafka_message(),
  keyword()
) :: elsa_message()

Constructs a message struct from the imported definition of a kafka_message as defined by the brod library with the addition of the topic and partition the message was read from as well as the optional generation id as defined by the message's relationship to a consumer group. Generation id defaults to nil in the event the message retrieved outside of the context of a consumer group.