public class ChronicleMQAppender<M extends Externalizable> extends Object implements MQAppender<M>, net.openhft.chronicle.queue.impl.StoreFileListener
Modifier and Type | Method and Description |
---|---|
MQOffset |
append(int partition,
M 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. |
static <M extends Externalizable> |
create(File basePath,
int size)
Create a new mqueues.
|
static <M extends Externalizable> |
create(File basePath,
int size,
String retentionPolicy)
Create a new mqueues
|
MQTailer<M> |
createTailer(MQPartition partition,
String group) |
static boolean |
exists(File basePath) |
String |
getBasePath() |
String |
name()
Returns the MQueue's name.
|
void |
onAcquired(int cycle,
File file) |
void |
onReleased(int cycle,
File file) |
static <M extends Externalizable> |
open(File basePath)
Open an existing mqueues.
|
static <M extends Externalizable> |
open(File basePath,
String retentionDuration)
Open an existing mqueues.
|
protected void |
purgeQueue(int lowerCycle,
int upperCycle,
net.openhft.chronicle.queue.impl.single.SingleChronicleQueue queue)
Files in queue older than the current date minus the retention duration are candidates for purging, knowing that
the more recent files should be kept to ensure no data loss (for example after an interruption longer than the
retention duration).
|
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 String getBasePath()
public static <M extends Externalizable> ChronicleMQAppender<M> create(File basePath, int size, String retentionPolicy)
public static <M extends Externalizable> ChronicleMQAppender<M> create(File basePath, int size)
public static <M extends Externalizable> ChronicleMQAppender<M> open(File basePath)
public static <M extends Externalizable> ChronicleMQAppender<M> open(File basePath, String retentionDuration)
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, M 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 MQTailer<M> createTailer(MQPartition partition, String group)
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
public void onAcquired(int cycle, File file)
onAcquired
in interface net.openhft.chronicle.queue.impl.StoreFileListener
protected void purgeQueue(int lowerCycle, int upperCycle, net.openhft.chronicle.queue.impl.single.SingleChronicleQueue queue)
public void onReleased(int cycle, File file)
onReleased
in interface net.openhft.chronicle.queue.impl.StoreFileListener
Copyright © 2017 Nuxeo. All rights reserved.