@@ -5,7 +5,7 @@ clj-kafka-x.consumers.simple
55 (:require [clj-kafka-x.data :refer :all ])
66 (:import java.util.List
77 java.util.regex.Pattern
8- [org.apache.kafka.clients.consumer ConsumerRebalanceListener KafkaConsumer OffsetAndMetadata OffsetCommitCallback]
8+ [org.apache.kafka.clients.consumer ConsumerRebalanceListener Consumer KafkaConsumer OffsetAndMetadata OffsetCommitCallback]
99 [org.apache.kafka.common.serialization ByteArrayDeserializer Deserializer StringDeserializer]
1010 org.apache.kafka.common.TopicPartition
1111 (java.util Map)))
@@ -93,7 +93,7 @@ clj-kafka-x.consumers.simple
9393 http://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#subscribe(java.util.regex.Pattern,%20org.apache.kafka.clients.consumer.ConsumerRebalanceListener)
9494 http://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#assign(java.util.List)
9595 "
96- [^KafkaConsumer consumer topics & {:keys [assigned-callback revoked-callback]
96+ [^Consumer consumer topics & {:keys [assigned-callback revoked-callback]
9797 :or {assigned-callback (fn [_])
9898 revoked-callback (fn [_])}}]
9999 ; ;TODO needs to be cleaned up and refactored
@@ -134,7 +134,7 @@ clj-kafka-x.consumers.simple
134134 ;; {:topic \" topic-b\" , :partitions #{0 1 2}},
135135 ;; {:topic \" topic-c\" , :partitions #{}}]
136136 "
137- [^KafkaConsumer consumer]
137+ [^Consumer consumer]
138138 ; ;TODO is this clear and readable enough ? refactor?
139139 (let [auto-subs (.subscription consumer)
140140 manual-subs (.assignment consumer)
@@ -153,7 +153,7 @@ clj-kafka-x.consumers.simple
153153(defn unsubscribe
154154 " Unsubcribes the consumer from any subscribed topics and/or partitions.
155155 It works for subscriptions carried out via subscribe-to-topics or subscribe-to-partitions functions"
156- [^KafkaConsumer consumer]
156+ [^Consumer consumer]
157157 (.unsubscribe consumer))
158158
159159(defn seek
@@ -190,9 +190,9 @@ clj-kafka-x.consumers.simple
190190 ;; => nil
191191
192192 "
193- ([^KafkaConsumer consumer topic partition offset]
193+ ([^Consumer consumer topic partition offset]
194194 (seek consumer (vector {:topic topic :partition partition}) offset))
195- ([^KafkaConsumer consumer tp-seq offset]
195+ ([^Consumer consumer tp-seq offset]
196196 (let [tp-class-seq (map map->topic-partition tp-seq)
197197 tp-class-array (into-array TopicPartition tp-class-seq)]
198198 (cond
@@ -229,7 +229,7 @@ clj-kafka-x.consumers.simple
229229 ;; :value \" Count Zero says 3 at Fri Mar 11 14:34:32 GMT 2016\" }]
230230
231231 "
232- [^KafkaConsumer consumer & {:keys [timeout] :or {timeout 1000 }}]
232+ [^Consumer consumer & {:keys [timeout] :or {timeout 1000 }}]
233233
234234 (let [consumer-records (.poll consumer timeout)]
235235 (to-clojure consumer-records)))
@@ -272,13 +272,13 @@ clj-kafka-x.consumers.simple
272272 (println \" Commits passed for \" offsets))))
273273 ;; => nil
274274 "
275- ([^KafkaConsumer consumer] (.commitAsync consumer))
276- ([^KafkaConsumer consumer offset-commit-fn]
275+ ([^Consumer consumer] (.commitAsync consumer))
276+ ([^Consumer consumer offset-commit-fn]
277277 (let [callback (reify OffsetCommitCallback
278278 (onComplete [_ offsets exception]
279279 (offset-commit-fn (tp-om-map->map offsets) exception)))]
280280 (.commitAsync consumer callback)))
281- ([^KafkaConsumer consumer topic-partition-offsets-metadata offset-commit-fn]
281+ ([^Consumer consumer topic-partition-offsets-metadata offset-commit-fn]
282282 (let [callback (reify OffsetCommitCallback
283283 (onComplete [_ offsets exception]
284284 (offset-commit-fn (tp-om-map->map offsets) exception)))
@@ -306,8 +306,8 @@ clj-kafka-x.consumers.simple
306306 (commit-sync consumer tp-om)
307307 ;; => nil
308308 "
309- ([^KafkaConsumer consumer] (.commitSync consumer))
310- ([^KafkaConsumer consumer topic-partitions-offsets-metadata]
309+ ([^Consumer consumer] (.commitSync consumer))
310+ ([^Consumer consumer topic-partitions-offsets-metadata]
311311 (let [tp-om-map (map->tp-om-map topic-partitions-offsets-metadata)]
312312 (.commitSync consumer tp-om-map))))
313313
@@ -323,7 +323,7 @@ clj-kafka-x.consumers.simple
323323 (last-committed-offset consumer {:topic \" topic-a\" :partition 2})
324324 ;; => {:offset 10, :metadata \" Metadata set during commit\" }
325325 "
326- [^KafkaConsumer consumer tp]
326+ [^Consumer consumer tp]
327327 (->> tp
328328 map->topic-partition
329329 (.committed consumer)
@@ -362,7 +362,7 @@ clj-kafka-x.consumers.simple
362362 ;; :replicas [{:id 2, :host \" 172.17.0.3\" , :port 9093}],
363363 ;; :in-sync-replicas [{:id 2, :host \" 172.17.0.3\" , :port 9093}]}]}
364364 "
365- [^KafkaConsumer consumer]
365+ [^Consumer consumer]
366366 (str-pi-map->map (.listTopics consumer)))
367367
368368(defn list-all-partitions
@@ -390,7 +390,7 @@ clj-kafka-x.consumers.simple
390390 ;; :replicas [{:id 2, :host \" 172.17.0.3\" , :port 9093}],
391391 ;; :in-sync-replicas [{:id 2, :host \" 172.17.0.3\" , :port 9093}]}]
392392"
393- [^KafkaConsumer consumer topic]
393+ [^Consumer consumer topic]
394394 (mapv to-clojure (.partitionsFor consumer topic)))
395395
396396
@@ -404,7 +404,7 @@ clj-kafka-x.consumers.simple
404404 (pause consumer {:topic \" topic-a\" :partition 2}
405405 {:topic \" topic-b\" :partition 0})
406406 "
407- [^KafkaConsumer consumer tp-seq]
407+ [^Consumer consumer tp-seq]
408408 (->> (map map->topic-partition tp-seq)
409409 (into-array TopicPartition)
410410 (.pause consumer)))
@@ -420,7 +420,7 @@ clj-kafka-x.consumers.simple
420420 (resume consumer {:topic \" topic-a\" :partition 2}
421421 {:topic \" topic-b\" :partition 0})
422422 "
423- [^KafkaConsumer consumer tp-seq]
423+ [^Consumer consumer tp-seq]
424424 (->> (map map->topic-partition tp-seq)
425425 (into-array TopicPartition)
426426 (.resume consumer)))
@@ -445,5 +445,5 @@ clj-kafka-x.consumers.simple
445445 ;; :tags {\" client-id\" \" consumer-3\" },
446446 ;; :value 0.0}]
447447 "
448- [^KafkaConsumer consumer]
448+ [^Consumer consumer]
449449 (metrics->map (.metrics consumer)))
0 commit comments