franzy.clients.codec
Encodes and decodes Java and Clojure types used with org.apache.kafka.common
See http://kafka.apache.org/090/javadoc/org/apache/kafka/common/package-summary.html
consumer-record->map
(consumer-record->map consumer-record)
Converts a Kafka Java API ConsumerRecord to a map.
consumer-records->map
(consumer-records->map consumer-records)
Converts a Kafka Java API ConsumerRecords to a map.
decode-xf
Transducer, applied on decode of collections that may be overriden using alter-var-root for example.
FranzCodec
protocol
Protocol used to encode and decode values between Franzy and the Kafka Java client.
Extend this protocol to implement conversions between types and modify existing conversions as needed.
members
decode
(decode v)
encode
(encode v)
keyword->offset-reset-strategy
(keyword->offset-reset-strategy offset-reset-strategy)
lazy-consumer-records
(lazy-consumer-records iterable)
Creates a lazy wrapper around Java ConsumerRecordsConcatenatedIterables. Useful if you want to create a wrapper or consume existing Java Kafka client code.
map->consumer-record
(map->consumer-record {:keys [key offset partition topic value]})
Convert a map of to a Kafka ConsumerRecord
map->node
(map->node {:keys [id host port]})
Converts a node map to a Kafka Node.
map->offset-metadata
(map->offset-metadata {:keys [offset metadata]})
map->partition-info
(map->partition-info {:keys [topic partition leader replicas in-sync-replicas]})
map->producer-record
(map->producer-record {:keys [topic partition key value]})
(map->producer-record topic partition key value)
map->topic-partition
(map->topic-partition topic partition)
(map->topic-partition {:keys [topic partition]})
Convert a map of topic and partition to a Kafka TopicPartition.
Example Usage:
(map->topic-partition {:topic "pontifications" :partition 613})
map->topic-partition-offset-number
(map->topic-partition-offset-number m)
Converts a map where the keys are topic partitions and the values are offset positions (Long) to a map of Map<TopicPartition, Long>
Example:
(map->topic-partition-offset-number
{{:topic "fixins" :partition 0} 0
{:topic "fixins" :partition 1} 0}
{:topic "expired-condiments" :partition 55} 23})
map->topic-partition-offsets-map
(map->topic-partition-offsets-map m)
Takes a Clojure map where the keys are topic partition maps and the values are offset metaedata maps, then converts it to a java.util.Map made of TopicPartition as keys and OffsetAndMetadata as values.
Example:
(map->topic-partition-offsets-map
{{:topic "theweather" :partition 0} {:offset 89 :metadata "seti alpha 6"}
{:topic "thegovernment" :partition 1} {:offset 2112 :metadata "1984"}
{:topic "popsongs" :partition 1} {:offset 69 :metadata "All I need is a miracle"}})
maps->topic-partition-array
(maps->topic-partition-array topic-partitions)
Converts a collection of maps to topic partition arrays.
maps->topic-partitions
(maps->topic-partitions topic-partitions)
Converts a collection of maps to topic partitions.
node-maps->node-array
(node-maps->node-array nodes)
Converts a collection of node maps to a Kafka Node[]