public class KafkaMQTailer<M extends Externalizable> extends Object implements MQTailer<M>, org.apache.kafka.clients.consumer.ConsumerRebalanceListener
Modifier | Constructor and Description |
---|---|
protected |
KafkaMQTailer(String prefix,
String group,
Properties consumerProps) |
Modifier and Type | Method and Description |
---|---|
Collection<MQPartition> |
assignments()
Returns the list of MQueue name/partition tuples currently assigned to this tailer.
|
void |
close() |
boolean |
closed()
Returns
true if the tailer has been closed. |
void |
commit()
Commit current positions for all partitions (last message offset returned by read).
|
MQOffset |
commit(MQPartition partition)
Commit current position for the partition.
|
static <M extends Externalizable> |
createAndAssign(String prefix,
Collection<MQPartition> partitions,
String group,
Properties consumerProps) |
static <M extends Externalizable> |
createAndSubscribe(String prefix,
Collection<String> names,
String group,
Properties consumerProps,
MQRebalanceListener listener) |
String |
group()
Returns the consumer group.
|
void |
onPartitionsAssigned(Collection<org.apache.kafka.common.TopicPartition> newPartitions) |
void |
onPartitionsRevoked(Collection<org.apache.kafka.common.TopicPartition> partitions) |
MQRecord<M> |
read(Duration timeout)
Read a message from assigned partitions within the timeout.
|
void |
seek(MQPartition partition,
MQOffset offset) |
void |
toEnd()
Set the current positions to the end of all partitions.
|
void |
toLastCommitted()
Set the current positions to previously committed positions.
|
void |
toStart()
Set the current position to the fist message of all partitions.
|
String |
toString() |
protected KafkaMQTailer(String prefix, String group, Properties consumerProps)
public static <M extends Externalizable> KafkaMQTailer<M> createAndAssign(String prefix, Collection<MQPartition> partitions, String group, Properties consumerProps)
public static <M extends Externalizable> KafkaMQTailer<M> createAndSubscribe(String prefix, Collection<String> names, String group, Properties consumerProps, MQRebalanceListener listener)
public MQRecord<M> read(Duration timeout) throws InterruptedException
MQTailer
read
in interface MQTailer<M extends Externalizable>
InterruptedException
public void toEnd()
MQTailer
toEnd
in interface MQTailer<M extends Externalizable>
public void toStart()
MQTailer
toStart
in interface MQTailer<M extends Externalizable>
public void toLastCommitted()
MQTailer
toLastCommitted
in interface MQTailer<M extends Externalizable>
public void seek(MQPartition partition, MQOffset offset)
public void commit()
MQTailer
commit
in interface MQTailer<M extends Externalizable>
public MQOffset commit(MQPartition partition)
MQTailer
commit
in interface MQTailer<M extends Externalizable>
public Collection<MQPartition> assignments()
MQTailer
MQManager.subscribe(java.lang.String, java.util.Collection<java.lang.String>, org.nuxeo.ecm.platform.importer.mqueues.mqueues.MQRebalanceListener)
.assignments
in interface MQTailer<M extends Externalizable>
public String group()
MQTailer
group
in interface MQTailer<M extends Externalizable>
public boolean closed()
MQTailer
true
if the tailer has been closed.closed
in interface MQTailer<M extends Externalizable>
public void close() throws Exception
close
in interface AutoCloseable
Exception
public void onPartitionsRevoked(Collection<org.apache.kafka.common.TopicPartition> partitions)
onPartitionsRevoked
in interface org.apache.kafka.clients.consumer.ConsumerRebalanceListener
public void onPartitionsAssigned(Collection<org.apache.kafka.common.TopicPartition> newPartitions)
onPartitionsAssigned
in interface org.apache.kafka.clients.consumer.ConsumerRebalanceListener
Copyright © 2017 Nuxeo. All rights reserved.