public interface MessageQueue extends BlockingQueue<String>, Closeable
Implementation note: due to the underlying MQ capabilities, this implementation of
BlockingQueue
is not expected to implement the following methods:
Modifier and Type | Interface and Description |
---|---|
static interface |
MessageQueue.IMQCallback
Callback interface to scan a message queue for new messages
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_MESSAGE_COUNT
Maximum allowed message-count per queue.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
getName()
Returns the name of the queue as specified via
MessageQueues.createAndOpen(String, int) or
MessageQueues.open(String, boolean) respectively. |
boolean |
isQuitPending()
This function tests whether the specified message queue is in a QUIT state, and returns TRUE if so.
|
void |
put(byte[] buffer,
int priority,
int offset,
int length)
This function adds a message to the message queue.
The message will be placed in the queue according to the value of its priority argument - higher priority messages will be enqueued ahead of lower priority messages. If the queue is full or in a QUIT state, the message will not be put in the queue, and the function will return an appropriate error code. |
void |
putQuitMsg()
This function puts the message queue in a QUIT state, which indicates to
applications that read the message queue that they should terminate.
|
int |
scan(byte[] buffer,
MessageQueue.IMQCallback callback)
This function parses a message queue, calling an action routine for each message in the queue.
If the message queue is empty, or if all messages in the queue have been enumerated without returning an error code, MQScan returns ERR_MQ_EMPTY. In the simple case, MQScan() does not modify the contents of the queue; by returning the appropriate error codes to MQScan, the action routine can specify that messages are to be removed from the queue or skipped, or that enumeration is to be terminated immediately. |
add, contains, drainTo, drainTo, offer, offer, poll, put, remainingCapacity, remove, take
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
static final int MAX_MESSAGE_COUNT
String getName()
MessageQueues.createAndOpen(String, int)
or
MessageQueues.open(String, boolean)
respectively.int scan(byte[] buffer, MessageQueue.IMQCallback callback)
MessageQueue.IMQCallback
for more details.buffer
- buffer to be used to read messages, max size is 65326 bytescallback
- callback to be called for each message; if null, we dequeue the a message and return it in the specified buffercallback
has been set to null)void putQuitMsg()
void put(byte[] buffer, int priority, int offset, int length)
buffer
- buffer containing the message. Maximum buffer length is 65326 bytespriority
- priorityoffset
- offset in the buffer where the message startslength
- lengths of the message in the bufferboolean isQuitPending()
void close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2019–2021 HCL. All rights reserved.