Package com.swiftmq.swiftlet.queue
Class AbstractQueue
- java.lang.Object
-
- com.swiftmq.swiftlet.queue.AbstractQueue
-
- Direct Known Subclasses:
ClusteredQueue
,CompositeQueue
,MessageQueue
,TopicBroker
public abstract class AbstractQueue extends java.lang.Object
Abstract base class for queues used in SwiftMQ. All operations on the queue will be controlled by the queue manager. Access to queues are exclusively performed by the resp. accessor classes like QueuePull/PushTransaction.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTIVESTANDBY
static int
AS_MESSAGE
protected long
cleanUpInterval
protected int
consumerMode
static int
EXCLUSIVE
protected FlowController
flowController
protected int
maxMessages
static int
NON_PERSISTENT
protected int
persistenceMode
static int
PERSISTENT
protected int
receiverCount
static int
SHARED
protected boolean
temporary
-
Constructor Summary
Constructors Constructor Description AbstractQueue()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex)
Acknowledges a message that was fetched within a pull transaction.void
acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex, AsyncCompletionCallback callback)
Async acknowledges a message that was fetched within a pull transaction.void
acknowledgeMessages(java.lang.Object transactionId, java.util.List messageIndexList, AsyncCompletionCallback callback)
Async acknowledges a list of messages that were fetched within a pull transaction.void
addWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
java.lang.Object
buildPreparedTransaction(PrepareLogRecord logRecord)
Builds a new QueueTransaction on base of the PrepareLogRecord.void
cleanUpExpiredMessages()
Deletes all expired messages from the queueabstract void
commit(java.lang.Object transactionId)
Commit the transaction with the given transaction idabstract void
commit(java.lang.Object localtransactionId, XidImpl globalTransactionId)
Commits a prepared transaction.abstract void
commit(java.lang.Object transactionId, AsyncCompletionCallback callback)
Asynchronously commits the transaction with the given transaction idabstract java.lang.Object
createPullTransaction()
Creates a new pull transaction and returns a unique transaction idabstract java.lang.Object
createPushTransaction()
Creates a new push transaction and returns a unique transaction idint
createView(Selector selector)
Creates a new view, based on a selectorvoid
decReceiverCount()
Decrements the queue receiver count.void
deleteContent()
Removes all messages from the queue.void
deleteView(int viewId)
Creates a new view, based on a selectorvoid
flushAccounting()
int
getCacheSize()
Returns the max.int
getCacheSizeKB()
Returns the max cache size in KBlong
getCleanUpInterval()
Returns the cleanup interval in millisecondsCompositeStoreTransaction
getCompositeStoreTransaction(java.lang.Object txId)
Returns the current composite store transactionint
getConsumedTotal()
Returns the total number of consumed messagesint
getConsumerMode()
int
getConsumingRate()
Returns the consuming rate in Msgs/Secint
getCurrentCacheSizeKB()
Returns the current cache size in KBint
getCurrentCacheSizeMessages()
Returns the current cache size in number messages.MessageEntry
getExpiredMessage(java.lang.Object transactionId, long timeout)
Get the next expired message from the queue but wait only a specific period of time.FlowController
getFlowController()
Returns the flow controller.MessageIndex
getIndexEntry(MessageIndex messageIndex)
Returns the actual index entry (the implementation of the MessageIndex class) used for this MessageIndexjava.lang.String
getLocalName()
Returns the local name.int
getMaxMessages()
Returns the max.MessageEntry
getMessage(java.lang.Object transactionId)
Get a message from the queue.MessageEntry
getMessage(java.lang.Object transactionId, long timeout)
Get a message from the queue but wait only a specific period of time.MessageEntry
getMessage(java.lang.Object transactionId, Selector selector)
Get a message from the queue that matches the selector.MessageEntry
getMessage(java.lang.Object transactionId, Selector selector, int viewId)
Get the next message from a view.MessageEntry
getMessage(java.lang.Object transactionId, Selector selector, int viewId, long timeout)
Get the next message from the view but wait only a specific period of time.MessageEntry
getMessage(java.lang.Object transactionId, Selector selector, long timeout)
Get a message from the queue that matches the selector but wait only a specific period of time.MessageEntry
getMessageByIndex(MessageIndex messageIndex)
Returns the message with that given key.int
getMonitorAlertThreshold()
long
getNumberQueueMessages()
Returns the number of messages actually stored in the queueint
getPersistenceMode()
Returns the queue persistence mode.int
getProducedTotal()
Returns the total number of produced messagesint
getProducingRate()
Returns the producing rate in Msgs/Secjava.util.SortedSet
getQueueIndex()
Returns a current snapshot of the queue index (message indexes)java.util.SortedSet
getQueueIndex(int viewId)
Returns a current snapshot of the viewjava.lang.String
getQueueName()
Returns the queue nameQueueReceiverListener
getQueueReceiverListener()
int
getReceiverCount()
Returns the queue receiver count.abstract boolean
hasReceiver(MessageImpl message)
Checks all registered receivers and, if set, their message selectors whether this message will be received by one of them.void
incReceiverCount()
Increments the queue receiver count.boolean
isAccounting()
boolean
isRunning()
Returns if the queue is running or notboolean
isTemporary()
Returns the temporary flag.void
lockQueue(java.lang.Object txId)
Locks this queue and holds it until unlockQueue is called.void
moveToTransaction(MessageIndex messageIndex, java.lang.Object destTxId)
Moves a message with the given message index to the destination transaction.void
moveToTransaction(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId)
Moves a message with the given message index from the source to the destination transaction.long
moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object destTxId)
Moves a message with the given message index to the destination transaction and returns the message size.long
moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId)
Moves a message with the given message index from the source to the destination transaction and returns its size.abstract void
prepare(java.lang.Object localtransactionId, XidImpl globalTransactionId)
Prepares the transaction with the given transaction id.abstract void
putMessage(java.lang.Object transactionId, MessageImpl message)
Put a message into the queuevoid
receiverClosed(long receiverId)
Internal usevoid
registerMessageProcessor(MessageProcessor messageProcessor)
Registers a message processor.void
removeMessageByIndex(MessageIndex messageIndex)
Removes a message with that given key outside a queue transaction.void
removeMessages(java.lang.Object transactionId, java.util.List<MessageIndex> messageIndexes)
Remove messages from a queuevoid
removeWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
void
resetCounters()
Resets all consumed/produced countersabstract void
rollback(java.lang.Object transactionId, boolean setRedelivered)
Rolls back the transaction with the given transaction id.abstract void
rollback(java.lang.Object transactionId, boolean setRedelivered, AsyncCompletionCallback callback)
Asynchronously rolls back the transaction with the given transaction id.abstract void
rollback(java.lang.Object transactionId, XidImpl globalTransactionId, boolean setRedelivered)
Rolls back the transaction with the given transaction id, eventually prepared under a global transaction id.AbstractQueue
selectBaseQueue()
Selects the underlaying base queue of this queue.void
setCleanUpInterval(long cleanUpInterval)
Sets the cleanup interval.void
setCompositeStoreTransaction(java.lang.Object txId, CompositeStoreTransaction ct)
Sets a CompositeStoreTransaction to be used as the current transaction.void
setConsumerMode(int consumerMode)
void
setFlowController(FlowController flowController)
Sets the flow controller.void
setLocalName(java.lang.String localName)
Sets the local name.void
setMaxMessages(int maxMessages)
Sets the max.void
setPersistenceMode(int persistenceMode)
Sets the queue persistence mode.void
setQueueName(java.lang.String queueName)
Set the queue name.void
setQueueReceiverListener(QueueReceiverListener queueReceiverListener)
void
setTemporary(boolean b)
Sets the temporary flag.void
startAccounting(java.lang.Object accountingProfile)
void
startQueue()
Starts the queue.void
stopAccounting()
void
stopQueue()
Stops the queue.void
timeoutMessageProcessor(long registrationTime, int id)
Removes a message processor which has been timed out.void
unlockQueue(java.lang.Object txId, boolean markAsyncActive)
Unlocks this queue.void
unmarkAsyncActive(java.lang.Object txId)
Unblocks this queue from async activevoid
unregisterMessageProcessor(MessageProcessor messageProcessor)
Unregisters a message processor.
-
-
-
Field Detail
-
SHARED
public static final int SHARED
- See Also:
- Constant Field Values
-
EXCLUSIVE
public static final int EXCLUSIVE
- See Also:
- Constant Field Values
-
ACTIVESTANDBY
public static final int ACTIVESTANDBY
- See Also:
- Constant Field Values
-
AS_MESSAGE
public static final int AS_MESSAGE
- See Also:
- Constant Field Values
-
PERSISTENT
public static final int PERSISTENT
- See Also:
- Constant Field Values
-
NON_PERSISTENT
public static final int NON_PERSISTENT
- See Also:
- Constant Field Values
-
maxMessages
protected volatile int maxMessages
-
persistenceMode
protected volatile int persistenceMode
-
temporary
protected boolean temporary
-
flowController
protected FlowController flowController
-
receiverCount
protected int receiverCount
-
cleanUpInterval
protected long cleanUpInterval
-
consumerMode
protected int consumerMode
-
-
Method Detail
-
getQueueName
public java.lang.String getQueueName()
Returns the queue name- Returns:
- queue name
-
setQueueName
public void setQueueName(java.lang.String queueName)
Set the queue name. Will be called from queue manager- Parameters:
queueName
- queue name
-
getLocalName
public java.lang.String getLocalName()
Returns the local name.- Returns:
- local name.
-
setLocalName
public void setLocalName(java.lang.String localName)
Sets the local name.- Parameters:
localName
- local name.
-
getCacheSize
public int getCacheSize()
Returns the max. cache size in number messages.- Returns:
- cache size.
-
getCacheSizeKB
public int getCacheSizeKB()
Returns the max cache size in KB- Returns:
- cache size.
-
getCurrentCacheSizeMessages
public int getCurrentCacheSizeMessages()
Returns the current cache size in number messages.- Returns:
- cache size.
-
getCurrentCacheSizeKB
public int getCurrentCacheSizeKB()
Returns the current cache size in KB- Returns:
- cache size.
-
isAccounting
public boolean isAccounting()
-
getConsumerMode
public int getConsumerMode()
-
setConsumerMode
public void setConsumerMode(int consumerMode)
-
startAccounting
public void startAccounting(java.lang.Object accountingProfile)
-
flushAccounting
public void flushAccounting()
-
stopAccounting
public void stopAccounting()
-
addWireTapSubscriber
public void addWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
-
removeWireTapSubscriber
public void removeWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
-
getQueueReceiverListener
public QueueReceiverListener getQueueReceiverListener()
-
setQueueReceiverListener
public void setQueueReceiverListener(QueueReceiverListener queueReceiverListener)
-
getFlowController
public FlowController getFlowController()
Returns the flow controller.- Returns:
- flow controller.
-
setFlowController
public void setFlowController(FlowController flowController)
Sets the flow controller.- Parameters:
flowController
- flow controller.
-
incReceiverCount
public void incReceiverCount()
Increments the queue receiver count.
-
decReceiverCount
public void decReceiverCount()
Decrements the queue receiver count.
-
getReceiverCount
public int getReceiverCount()
Returns the queue receiver count.- Returns:
- queue receiver count
-
receiverClosed
public void receiverClosed(long receiverId)
Internal use- Parameters:
receiverId
-
-
getMaxMessages
public int getMaxMessages()
Returns the max. messages.- Returns:
- max messages.
-
setMaxMessages
public void setMaxMessages(int maxMessages)
Sets the max. messages.- Parameters:
maxMessages
- max messages.
-
isTemporary
public boolean isTemporary()
Returns the temporary flag.- Returns:
- temporary flag.
-
setTemporary
public void setTemporary(boolean b)
Sets the temporary flag.- Parameters:
b
- temporary flag.
-
getPersistenceMode
public int getPersistenceMode()
Returns the queue persistence mode.- Returns:
- queue persistence mode.
-
setPersistenceMode
public void setPersistenceMode(int persistenceMode)
Sets the queue persistence mode.- Parameters:
persistenceMode
- persistence mode.
-
startQueue
public void startQueue() throws QueueException
Starts the queue.- Throws:
QueueException
- on error
-
stopQueue
public void stopQueue() throws QueueException
Stops the queue.- Throws:
QueueException
- on error
-
isRunning
public boolean isRunning()
Returns if the queue is running or not- Returns:
- true/false
-
buildPreparedTransaction
public java.lang.Object buildPreparedTransaction(PrepareLogRecord logRecord) throws QueueException
Builds a new QueueTransaction on base of the PrepareLogRecord.- Returns:
- transaction id
- Throws:
QueueException
- on error
-
createView
public int createView(Selector selector)
Creates a new view, based on a selector- Returns:
- view id
-
deleteView
public void deleteView(int viewId)
Creates a new view, based on a selector
-
createPushTransaction
public abstract java.lang.Object createPushTransaction() throws QueueException
Creates a new push transaction and returns a unique transaction id- Returns:
- transaction id
- Throws:
QueueException
- on error
-
createPullTransaction
public abstract java.lang.Object createPullTransaction() throws QueueException
Creates a new pull transaction and returns a unique transaction id- Returns:
- transaction id
- Throws:
QueueException
- on error
-
selectBaseQueue
public AbstractQueue selectBaseQueue()
Selects the underlaying base queue of this queue. If there is no base queue, this queue instance will be returned.- Returns:
- base queue
-
prepare
public abstract void prepare(java.lang.Object localtransactionId, XidImpl globalTransactionId) throws QueueException
Prepares the transaction with the given transaction id. Messages are stored in the queue (on disk when persistent) but not unlocked. The preparation is logged under the global transaction id.- Parameters:
localtransactionId
- local transaction idglobalTransactionId
- global transaction id- Throws:
QueueException
- on error
-
commit
public abstract void commit(java.lang.Object localtransactionId, XidImpl globalTransactionId) throws QueueException
Commits a prepared transaction.- Parameters:
localtransactionId
- local transaction idglobalTransactionId
- global transaction id- Throws:
QueueException
- on error
-
commit
public abstract void commit(java.lang.Object transactionId) throws QueueException
Commit the transaction with the given transaction id- Parameters:
transactionId
- transaction id- Throws:
QueueException
- on error
-
commit
public abstract void commit(java.lang.Object transactionId, AsyncCompletionCallback callback)
Asynchronously commits the transaction with the given transaction id- Parameters:
transactionId
- transaction idcallback
- async completion callback
-
rollback
public abstract void rollback(java.lang.Object transactionId, XidImpl globalTransactionId, boolean setRedelivered) throws QueueException
Rolls back the transaction with the given transaction id, eventually prepared under a global transaction id. If the flagsetRedelivered
is set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated.- Parameters:
transactionId
- transaction idglobalTransactionId
- global transaction idsetRedelivered
- specifies JMS redelivery setting- Throws:
QueueException
- on error
-
rollback
public abstract void rollback(java.lang.Object transactionId, boolean setRedelivered) throws QueueException
Rolls back the transaction with the given transaction id. If the flagsetRedelivered
is set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated- Parameters:
transactionId
- transaction idsetRedelivered
- specifies JMS redelivery setting- Throws:
QueueException
- on error
-
rollback
public abstract void rollback(java.lang.Object transactionId, boolean setRedelivered, AsyncCompletionCallback callback)
Asynchronously rolls back the transaction with the given transaction id. If the flagsetRedelivered
is set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated- Parameters:
transactionId
- transaction idsetRedelivered
- specifies JMS redelivery settingcallback
- async completion callback
-
cleanUpExpiredMessages
public void cleanUpExpiredMessages() throws QueueException
Deletes all expired messages from the queue- Throws:
QueueException
- on error
-
getCleanUpInterval
public long getCleanUpInterval() throws QueueException
Returns the cleanup interval in milliseconds- Returns:
- interval
- Throws:
QueueException
- on error
-
setCleanUpInterval
public void setCleanUpInterval(long cleanUpInterval)
Sets the cleanup interval.- Parameters:
cleanUpInterval
- cleanup interval.
-
getNumberQueueMessages
public long getNumberQueueMessages() throws QueueException
Returns the number of messages actually stored in the queue- Returns:
- number of messages
- Throws:
QueueException
- on error
-
getConsumingRate
public int getConsumingRate()
Returns the consuming rate in Msgs/Sec- Returns:
- consuming rate
-
getProducingRate
public int getProducingRate()
Returns the producing rate in Msgs/Sec- Returns:
- producing rate
-
getConsumedTotal
public int getConsumedTotal()
Returns the total number of consumed messages- Returns:
- total number of consumed messages
-
getProducedTotal
public int getProducedTotal()
Returns the total number of produced messages- Returns:
- total number of produced messages
-
resetCounters
public void resetCounters()
Resets all consumed/produced counters
-
getMonitorAlertThreshold
public int getMonitorAlertThreshold()
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId) throws QueueException
Get a message from the queue. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId
-- Returns:
- The message
- Throws:
QueueException
- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector) throws QueueException
Get a message from the queue that matches the selector. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId
- a valid pull transaction idselector
- A message selector- Returns:
- The message
- Throws:
QueueException
- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, int viewId) throws QueueException
Get the next message from a view. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId
- a valid pull transaction idselector
- a message selectorviewId
- view id- Returns:
- The message
- Throws:
QueueException
- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, long timeout) throws QueueException, QueueTimeoutException
Get a message from the queue but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId
- a valid pull transaction idtimeout
- a timeout in ms- Returns:
- The message
- Throws:
QueueException
- on errorQueueTimeoutException
- if a timeout occurs
-
getExpiredMessage
public MessageEntry getExpiredMessage(java.lang.Object transactionId, long timeout) throws QueueException, QueueTimeoutException
Get the next expired message from the queue but wait only a specific period of time. The method returns the next available expired message dependend on priority and message time stamp. If no expired message is available then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId
- a valid pull transaction idtimeout
- a timeout in ms- Returns:
- The message
- Throws:
QueueException
- on errorQueueTimeoutException
- if a timeout occurs
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, long timeout) throws QueueException, QueueTimeoutException
Get a message from the queue that matches the selector but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId
- a valid pull transaction idselector
- a message selectortimeout
- a timeout in ms- Returns:
- The message
- Throws:
QueueException
- on errorQueueTimeoutException
- if a timeout occurs
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, int viewId, long timeout) throws QueueException, QueueTimeoutException
Get the next message from the view but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId
- a valid pull transaction idselector
- a message selectorviewId
- view Idtimeout
- a timeout in ms- Returns:
- The message
- Throws:
QueueException
- on errorQueueTimeoutException
- if a timeout occurs
-
registerMessageProcessor
public void registerMessageProcessor(MessageProcessor messageProcessor)
Registers a message processor. The message processor will be called asynchrounsly when a message is available.- Parameters:
messageProcessor
- message processor.
-
unregisterMessageProcessor
public void unregisterMessageProcessor(MessageProcessor messageProcessor)
Unregisters a message processor.- Parameters:
messageProcessor
- message processor.
-
timeoutMessageProcessor
public void timeoutMessageProcessor(long registrationTime, int id)
Removes a message processor which has been timed out.- Parameters:
registrationTime
- registration time.id
- id of the message processor.
-
acknowledgeMessage
public void acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex, AsyncCompletionCallback callback)
Async acknowledges a message that was fetched within a pull transaction. The size of the message will be returned as a result of the callback. This is another way to commit a pull transaction because it commits a single message of the transaction. All other messages of the transaction remain locked.- Parameters:
transactionId
- a valid pull transaction idmessageIndex
- a valid message indexcallback
- async completion callback
-
acknowledgeMessages
public void acknowledgeMessages(java.lang.Object transactionId, java.util.List messageIndexList, AsyncCompletionCallback callback)
Async acknowledges a list of messages that were fetched within a pull transaction. The size of the messages will be returned as a result of the callback.- Parameters:
transactionId
- a valid pull transaction idmessageIndexList
- a list of valid message indexescallback
- async completion callback
-
acknowledgeMessage
public void acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex) throws QueueException
Acknowledges a message that was fetched within a pull transaction. This is another way to commit a pull transaction because it commits a single message of the transaction. All other messages of the transaction remain locked.- Parameters:
transactionId
- a valid pull transaction idmessageIndex
- a valid message index- Throws:
QueueException
- on error
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index from the source to the destination transaction and returns its size.- Parameters:
messageIndex
- message index.sourceTxId
- source transaction id.destTxId
- destination transaction id.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueException
- on error.
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index from the source to the destination transaction.- Parameters:
messageIndex
- message index.sourceTxId
- source transaction id.destTxId
- destination transaction id.- Throws:
QueueException
- on error.
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index to the destination transaction and returns the message size. The source transaction is determined by the message index.- Parameters:
messageIndex
- message index.destTxId
- destination transaction id.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueException
- on error.
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index to the destination transaction. The source transaction is determined by the message index.- Parameters:
messageIndex
- message index.destTxId
- destination transaction id.- Throws:
QueueException
- on error.
-
hasReceiver
public abstract boolean hasReceiver(MessageImpl message)
Checks all registered receivers and, if set, their message selectors whether this message will be received by one of them.- Parameters:
message
-- Returns:
- has receiver or not
-
putMessage
public abstract void putMessage(java.lang.Object transactionId, MessageImpl message) throws QueueException
Put a message into the queue- Parameters:
transactionId
- a valid push transaction idmessage
- the message- Throws:
QueueException
- on error
-
removeMessages
public void removeMessages(java.lang.Object transactionId, java.util.List<MessageIndex> messageIndexes) throws QueueException
Remove messages from a queue- Parameters:
transactionId
- a valid push transaction idmessageIndexes
- List of MessageIndexes to remove- Throws:
QueueException
- on error
-
getQueueIndex
public java.util.SortedSet getQueueIndex() throws QueueException
Returns a current snapshot of the queue index (message indexes)- Returns:
- queue index
- Throws:
QueueException
- on error
-
getQueueIndex
public java.util.SortedSet getQueueIndex(int viewId) throws QueueException
Returns a current snapshot of the view- Parameters:
viewId
- the view id- Returns:
- queue index
- Throws:
QueueException
- on error
-
getMessageByIndex
public MessageEntry getMessageByIndex(MessageIndex messageIndex) throws QueueException
Returns the message with that given key. If the message is not available anymore, the method returns null.- Parameters:
messageIndex
- message index- Returns:
- message entry
- Throws:
QueueException
- on error
-
removeMessageByIndex
public void removeMessageByIndex(MessageIndex messageIndex) throws QueueException
Removes a message with that given key outside a queue transaction.- Parameters:
messageIndex
-- Throws:
QueueException
- if the message is locked by another consumer
-
getIndexEntry
public MessageIndex getIndexEntry(MessageIndex messageIndex) throws QueueException
Returns the actual index entry (the implementation of the MessageIndex class) used for this MessageIndex- Parameters:
messageIndex
-- Returns:
- index entry
- Throws:
QueueException
- on error
-
deleteContent
public void deleteContent() throws QueueException
Removes all messages from the queue.- Throws:
QueueException
- on error
-
lockQueue
public void lockQueue(java.lang.Object txId)
Locks this queue and holds it until unlockQueue is called.- Parameters:
txId
- local transactionId
-
unlockQueue
public void unlockQueue(java.lang.Object txId, boolean markAsyncActive)
Unlocks this queue.- Parameters:
txId
- local transactionIdmarkAsyncActive
- blocks queue as async is active
-
unmarkAsyncActive
public void unmarkAsyncActive(java.lang.Object txId)
Unblocks this queue from async active- Parameters:
txId
- local transactionId
-
setCompositeStoreTransaction
public void setCompositeStoreTransaction(java.lang.Object txId, CompositeStoreTransaction ct)
Sets a CompositeStoreTransaction to be used as the current transaction. At the same time it disables prepare/commit/rollback calls inside this queue so that multiple queues can use the same transaction and prepare/commit/rollback is done outside.- Parameters:
txId
- local transactionIdct
- composite transaction
-
getCompositeStoreTransaction
public CompositeStoreTransaction getCompositeStoreTransaction(java.lang.Object txId)
Returns the current composite store transaction- Parameters:
txId
- local transactionId- Returns:
- composite transaction
-
-