public interface MQueues<M extends Message> extends AutoCloseable
Message
on different queues.
Consumer read Message
using a MQueues.Tailer
, the position of the tailer can be persisted.Modifier and Type | Interface and Description |
---|---|
static interface |
MQueues.Tailer<M>
Sequential reader for a queue.
|
Modifier and Type | Method and Description |
---|---|
Offset |
append(int queue,
M message)
Append a message into a queue, returns an
Offset . |
MQueues.Tailer<M> |
createTailer(int queue)
Create a new
MQueues.Tailer associed with the queue index. |
MQueues.Tailer<M> |
createTailer(int queue,
String name)
Create a new
MQueues.Tailer associed to a queue index, using a specified offset name space. |
int |
size()
Returns the size of the mqueues: the number of queues.
|
boolean |
waitFor(Offset offset,
Duration timeout)
Wait for consumer to process a message up to the offset.
|
close
int size()
Offset append(int queue, M message)
Offset
.
This method is thread safe, a queue can be shared by multiple producers.queue
- index lower than size()
MQueues.Tailer<M> createTailer(int queue)
MQueues.Tailer
associed with the queue index.
The committed offset is presisted in the default namespace.
There can be one and only one consumer for queue in a namespace.
A tailer is not thread safe.MQueues.Tailer<M> createTailer(int queue, String name)
MQueues.Tailer
associed to a queue index, using a specified offset name space.
The committed offset position is shared by all tailers of the same queue with the same name.
There can be one and only one consumer for queue in a namespace
A tailer is not thread safe.boolean waitFor(Offset offset, Duration timeout) throws InterruptedException
InterruptedException
Copyright © 2017 Nuxeo. All rights reserved.