public class KafkaMQAppender<M extends Externalizable> extends Object implements MQAppender<M>
Modifier and Type | Method and Description |
---|---|
MQOffset |
append(int partition,
Externalizable message)
Append a message into a partition, returns
MQOffset position of the message. |
void |
close() |
boolean |
closed()
Returns
true if the close has been closed. |
String |
getTopic() |
String |
name()
Returns the MQueue's name.
|
static <M extends Externalizable> |
open(String topic,
String name,
Properties producerProperties,
Properties consumerProperties) |
int |
size()
Returns the number of partitions.
|
boolean |
waitFor(MQOffset offset,
String group,
Duration timeout)
Wait for consumer to process a message up to the offset.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append
public static <M extends Externalizable> KafkaMQAppender<M> open(String topic, String name, Properties producerProperties, Properties consumerProperties)
public String name()
MQAppender
name
in interface MQAppender<M extends Externalizable>
public int size()
MQAppender
size
in interface MQAppender<M extends Externalizable>
public MQOffset append(int partition, Externalizable message)
MQAppender
MQOffset
position of the message.
This method is thread safe, a queue can be shared by multiple producers.append
in interface MQAppender<M extends Externalizable>
partition
- index lower than MQAppender.size()
public boolean waitFor(MQOffset offset, String group, Duration timeout) throws InterruptedException
MQAppender
true
if the message has been consumed, false
in case of timeout.waitFor
in interface MQAppender<M extends Externalizable>
InterruptedException
public boolean closed()
MQAppender
true
if the close has been closed.closed
in interface MQAppender<M extends Externalizable>
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2017 Nuxeo. All rights reserved.