kafka 1.0.0

Download zip

class: KafkaConsumer

[41:14] (extern: com.lehman.aussom.KafkaConsumer) extends: object

The Kafka consumer, for direct synchronous polling: cons = new KafkaConsumer("broker1:9092", "billing"); cons.setAutoOffsetReset("earliest"); cons.connect(); cons.subscribe([ "orders.created" ]); recs = cons.poll(1000); For continuous consumption under Aussom Server use KafkaListener instead - the server then owns the thread and lifecycle. Threading: a Kafka consumer belongs to ONE thread. The wrapper adds no locking; the Kafka client rejects cross-thread use itself. The single exception is wakeup(), callable from any thread to break a blocked poll(). Topic-partition maps are { "topic": s, "partition": i }; offsets lists are lists of those maps with an added "offset" (and optional "metadata") - the same shapes everywhere in this module.

Methods