Package com.swiftmq.swiftlet.queue
Class QueuePullTransaction
- java.lang.Object
-
- com.swiftmq.swiftlet.queue.QueueTransaction
-
- com.swiftmq.swiftlet.queue.QueuePullTransaction
-
- All Implemented Interfaces:
Recyclable
public class QueuePullTransaction extends QueueTransaction
Transaction to pull messages from a queue. It is created by a QueueReceiver- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
- See Also:
QueueReceiver.createTransaction(boolean)
-
-
Constructor Summary
Constructors Constructor Description QueuePullTransaction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledgeMessage(MessageIndex messageIndex)Acknowledge a single message of this transactionvoidacknowledgeMessage(MessageIndex messageIndex, AsyncCompletionCallback callback)Async acknowledge a single message of this transaction and returns its size as the result of the callback.voidacknowledgeMessages(java.util.List messageIndexList, AsyncCompletionCallback callback)Async acknowledge a list of messages of this transaction and returns their size as the result of the callback.MessageEntrygetExpiredMessage(long timeout)Get an expired message from the queue but wait only a specific period of time.MessageEntrygetMessage()Get a message from the queue.MessageEntrygetMessage(long timeout)Get a message from the queue but wait only a specific period of time.MessageEntrygetMessage(long timeout, Selector selector)Get a message from the queue that matches the selector but wait only a specific period of time.MessageEntrygetMessage(Selector selector)Get a message from the queue that matches the selector.voidmoveToTransaction(MessageIndex messageIndex)Moves a message with the given message index to this transaction.voidmoveToTransaction(MessageIndex messageIndex, QueuePullTransaction sourceTransaction)Moves a message with the given message index from the source to this transaction.longmoveToTransactionReturnSize(MessageIndex messageIndex)Moves a message with the given message index to this transaction and returns its size.longmoveToTransactionReturnSize(MessageIndex messageIndex, QueuePullTransaction sourceTransaction)Moves a message with the given message index from the source to this transaction and returns its size.voidregisterMessageProcessor(MessageProcessor messageProcessor)Registers a message processor.voidremoveMessages(java.util.List<MessageIndex> messageIndexes)Remove messages from a queuevoidrollback()Rollback of the transaction.voidrollback(XidImpl globalTransactionId, boolean setRedelivered)Rolls back the transaction with the given transaction id, eventually prepared under a global transaction id.voidunregisterMessageProcessor(MessageProcessor messageProcessor)Unregisters a message processor.-
Methods inherited from class com.swiftmq.swiftlet.queue.QueueTransaction
commit, commit, getAbstractQueue, getCompositeStoreTransaction, getQueue, getQueueName, getRecycleIndex, isClosed, isDoRollbackOnClose, isPrepared, isQueueRunning, isTemporaryQueue, lockQueue, prepare, reset, setCompositeStoreTransaction, setDoRollbackOnClose, setRecycleIndex, unlockQueue, unmarkAsyncActive, verifyTransactionState
-
-
-
-
Method Detail
-
getMessage
public MessageEntry getMessage() throws QueueTransactionClosedException, QueueException
Get a message from the queue.- Returns:
- The message
- Throws:
QueueTransactionClosedException- if the transaction was closedQueueException- thrown by the queue
-
getMessage
public MessageEntry getMessage(Selector selector) throws QueueTransactionClosedException, QueueException
Get a message from the queue that matches the selector.- Parameters:
selector- A message selector- Returns:
- The message
- Throws:
QueueTransactionClosedException- if the transaction was closedQueueException- thrown by the queue
-
getMessage
public MessageEntry getMessage(long timeout) throws QueueTransactionClosedException, QueueException, QueueTimeoutException
Get a message from the queue but wait only a specific period of time.- Parameters:
timeout- a timeout in ms- Returns:
- The message
- Throws:
QueueTransactionClosedException- if the transaction was closedQueueException- thrown by the queueQueueTimeoutException- if a timeout occurs
-
getExpiredMessage
public MessageEntry getExpiredMessage(long timeout) throws QueueTransactionClosedException, QueueException, QueueTimeoutException
Get an expired message from the queue but wait only a specific period of time.- Parameters:
timeout- a timeout in ms- Returns:
- The message
- Throws:
QueueTransactionClosedException- if the transaction was closedQueueException- thrown by the queueQueueTimeoutException- if a timeout occurs
-
getMessage
public MessageEntry getMessage(long timeout, Selector selector) throws QueueTransactionClosedException, QueueException, QueueTimeoutException
Get a message from the queue that matches the selector but wait only a specific period of time.- Parameters:
timeout- a timeout in msselector- a message selector- Returns:
- The message
- Throws:
QueueTransactionClosedException- if the transaction was closedQueueException- thrown by the queueQueueTimeoutException- if a timeout occurs
-
removeMessages
public void removeMessages(java.util.List<MessageIndex> messageIndexes) throws QueueTransactionClosedException, QueueException
Remove messages from a queue- Parameters:
messageIndexes- List of MessageIndexes to remove- Throws:
QueueException- on errorQueueTransactionClosedException
-
registerMessageProcessor
public void registerMessageProcessor(MessageProcessor messageProcessor) throws QueueTransactionClosedException, QueueException
Registers a message processor.- Parameters:
messageProcessor- message processor.- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
unregisterMessageProcessor
public void unregisterMessageProcessor(MessageProcessor messageProcessor) throws QueueTransactionClosedException, QueueException
Unregisters a message processor.- Parameters:
messageProcessor- message processor.- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
acknowledgeMessage
public void acknowledgeMessage(MessageIndex messageIndex) throws QueueTransactionClosedException, QueueException
Acknowledge a single message of this transaction- Parameters:
messageIndex- The message index- Throws:
QueueException- thrown by the queueQueueTransactionClosedException
-
acknowledgeMessage
public void acknowledgeMessage(MessageIndex messageIndex, AsyncCompletionCallback callback) throws QueueTransactionClosedException
Async acknowledge a single message of this transaction and returns its size as the result of the callback.- Parameters:
messageIndex- The message indexcallback- async completion callback- Throws:
QueueException- thrown by the queueQueueTransactionClosedException
-
acknowledgeMessages
public void acknowledgeMessages(java.util.List messageIndexList, AsyncCompletionCallback callback) throws QueueTransactionClosedExceptionAsync acknowledge a list of messages of this transaction and returns their size as the result of the callback.- Parameters:
messageIndexList- A list of message indexescallback- async completion callback- Throws:
QueueException- thrown by the queueQueueTransactionClosedException
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex, QueuePullTransaction sourceTransaction) throws QueueTransactionClosedException, QueueException
Moves a message with the given message index from the source to this transaction.- Parameters:
messageIndex- message index.sourceTransaction- source transaction.- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex, QueuePullTransaction sourceTransaction) throws QueueTransactionClosedException, QueueException
Moves a message with the given message index from the source to this transaction and returns its size.- Parameters:
messageIndex- message index.sourceTransaction- source transaction.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex) throws QueueTransactionClosedException, QueueException
Moves a message with the given message index to this transaction. The source transaction is determined by the message index.- Parameters:
messageIndex- message index.- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex) throws QueueTransactionClosedException, QueueException
Moves a message with the given message index to this transaction and returns its size. The source transaction is determined by the message index.- Parameters:
messageIndex- message index.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueTransactionClosedException- if the transaction was closed.QueueException- on error.
-
rollback
public void rollback(XidImpl globalTransactionId, boolean setRedelivered) throws QueueException, QueueTransactionClosedException
Rolls back the transaction with the given transaction id, eventually prepared under a global transaction id. If the flagsetRedeliveredis set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated.- Specified by:
rollbackin classQueueTransaction- Parameters:
globalTransactionId- global transaction idsetRedelivered- specifies JMS redelivery setting- Throws:
QueueException- on errorQueueTransactionClosedException
-
rollback
public void rollback() throws QueueException, QueueTransactionClosedExceptionRollback of the transaction.- Specified by:
rollbackin classQueueTransaction- Throws:
QueueException- thrown by the queueQueueTransactionClosedException- if the transaction was closed
-
-