brodex v0.0.2 Brodex.Message View Source
Represents a Kafka message.
Wrapper of :brod.message.
Link to this section Summary
Link to this section Types
Link to this type
record()
View Sourcerecord() ::
{:kafka_message, offset :: Brodex.offest(), key :: Brodex.key(),
value :: Brodex.value(), ts_type :: timestamp_type(),
ts :: :undefined | Brodex.int64(), headers :: Brodex.headers()}
Link to this type
t()
View Sourcet() :: %Brodex.Message{
headers: Brodex.headers(),
key: Brodex.key(),
offset: Brodex.offest(),
ts: :undefined | Brodex.int64(),
ts_type: timestamp_type(),
value: Brodex.value()
}
Link to this section Functions
Converts a record/0 into a Brodex.Message.
Examples
iex> Brodex.Message.from_record({:kafka_message, 164, "", "hello", :create, 1_563_946_803_056, []})
%Brodex.Message{
headers: [],
key: "",
offset: 164,
ts: 1_563_946_803_056,
ts_type: :create,
value: "hello"
}
iex> Brodex.Message.from_record({:kafka_message, 164, "", "hello", :undefined, :undefined, []})
%Brodex.Message{
headers: [],
key: "",
offset: 164,
ts: :undefined,
ts_type: :undefined,
value: "hello"
}
Converts a Brodex.Message into a record/0.
Examples
iex> Brodex.Message.to_record(%Brodex.Message{
...> headers: [],
...> key: "",
...> offset: 164,
...> ts: 1_563_946_803_056,
...> ts_type: :create,
...> value: "hello"
...> })
{:kafka_message, 164, "", "hello", :create, 1_563_946_803_056, []}