Class MessageQueue

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue
com.swiftmq.impl.queue.standard.queue.MessageQueue
All Implemented Interfaces:
Iterable, Collection, Queue

public class MessageQueue extends AbstractQueue
  • Field Details

    • queueContent

      protected SortedSet<StoreId> queueContent
    • duplicateBacklog

      protected OrderedSet duplicateBacklog
    • duplicateDetectionEnabled

      protected boolean duplicateDetectionEnabled
    • duplicateDetectionBacklogSize

      protected int duplicateDetectionBacklogSize
  • Constructor Details

    • MessageQueue

      public MessageQueue(SwiftletContext ctx, Cache cache, PersistentStore pStore, NonPersistentStore nStore, long cleanUpDelay)
  • Method Details

    • addWireTapSubscriber

      public void addWireTapSubscriber(String name, WireTapSubscriber subscriber)
    • removeWireTapSubscriber

      public void removeWireTapSubscriber(String name, WireTapSubscriber subscriber)
    • getNextMsgId

      protected long getNextMsgId()
    • setAlwaysDeliverExpired

      public void setAlwaysDeliverExpired(boolean alwaysDeliverExpired)
    • getCache

      public Cache getCache()
    • getCacheSize

      public int getCacheSize()
    • getCacheSizeKB

      public int getCacheSizeKB()
    • getCurrentCacheSizeMessages

      public int getCurrentCacheSizeMessages()
    • getCurrentCacheSizeKB

      public int getCurrentCacheSizeKB()
    • setDuplicateDetectionEnabled

      protected void setDuplicateDetectionEnabled(boolean duplicateDetectionEnabled)
    • setDuplicateDetectionBacklogSize

      protected void setDuplicateDetectionBacklogSize(int duplicateDetectionBacklogSize)
    • setFlowController

      public void setFlowController(FlowController flowController)
    • buildDuplicateBacklog

      protected void buildDuplicateBacklog()
    • insertDuplicateBacklog

      protected void insertDuplicateBacklog(String jmsMsgId, StoreId storeId)
    • startQueue

      public void startQueue() throws QueueException
      Throws:
      QueueException
    • stopQueue

      public void stopQueue() throws QueueException
      Throws:
      QueueException
    • isRunning

      public boolean isRunning()
    • createPushTransaction

      public Object createPushTransaction() throws QueueException
      Throws:
      QueueException
    • createPullTransaction

      public Object createPullTransaction() throws QueueException
      Throws:
      QueueException
    • createView

      public int createView(Selector selector)
    • deleteView

      public void deleteView(int viewId)
    • buildPreparedTransaction

      public Object buildPreparedTransaction(PrepareLogRecord record) throws QueueException
      Throws:
      QueueException
    • beforeTransactionComplete

      protected void beforeTransactionComplete()
    • prepare

      public void prepare(Object localTxId, XidImpl globalTxId) throws QueueException
      Throws:
      QueueException
    • commit

      public void commit(Object localTxId, XidImpl globalTxId) throws QueueException
      Throws:
      QueueException
    • commit

      public void commit(Object tId) throws QueueException
      Throws:
      QueueException
    • commit

      public void commit(Object tId, AsyncCompletionCallback callback)
    • removeFromDuplicateLog

      protected void removeFromDuplicateLog(String jmsMsgId, StoreId storeId)
    • rollback

      public void rollback(Object localTxId, XidImpl globalTxId, boolean setRedelivered) throws QueueException
      Throws:
      QueueException
    • rollback

      public void rollback(Object tId, boolean setRedelivered) throws QueueException
      Throws:
      QueueException
    • rollback

      public void rollback(Object tId, boolean setRedelivered, AsyncCompletionCallback callback)
    • cleanUpExpiredMessages

      public void cleanUpExpiredMessages() throws QueueException
      Throws:
      QueueException
    • getNumberQueueMessages

      public long getNumberQueueMessages() throws QueueException
      Throws:
      QueueException
    • getConsumingRate

      public int getConsumingRate()
    • getProducingRate

      public int getProducingRate()
    • getConsumedTotal

      public int getConsumedTotal()
    • getProducedTotal

      public int getProducedTotal()
    • getAndResetAverageLatency

      public long getAndResetAverageLatency()
    • resetCounters

      public void resetCounters()
    • getMessage

      public MessageEntry getMessage(Object transactionId) throws QueueException
      Throws:
      QueueException
    • getMessage

      public MessageEntry getMessage(Object transactionId, Selector selector) throws QueueException
      Throws:
      QueueException
    • getMessage

      public MessageEntry getMessage(Object transactionId, long timeout) throws QueueException, QueueTimeoutException
      Throws:
      QueueException
      QueueTimeoutException
    • getExpiredMessage

      public MessageEntry getExpiredMessage(Object tId, long timeout) throws QueueException, QueueTimeoutException
      Throws:
      QueueException
      QueueTimeoutException
    • getMessage

      public MessageEntry getMessage(Object tId, Selector selector, long timeout) throws QueueException, QueueTimeoutException
      Throws:
      QueueException
      QueueTimeoutException
    • getMessage

      public MessageEntry getMessage(Object transactionId, Selector selector, int viewId) throws QueueException
      Throws:
      QueueException
    • getMessage

      public MessageEntry getMessage(Object tId, Selector selector, int viewId, long timeout) throws QueueException, QueueTimeoutException
      Throws:
      QueueException
      QueueTimeoutException
    • registerMessageProcessor

      public void registerMessageProcessor(MessageProcessor messageProcessor)
    • unregisterMessageProcessor

      public void unregisterMessageProcessor(MessageProcessor messageProcessor)
    • isActive

      public boolean isActive()
    • activate

      public void activate(boolean b)
    • setConsumerMode

      public void setConsumerMode(int consumerMode)
    • receiverClosed

      public void receiverClosed(long receiverId)
    • timeoutMessageProcessor

      public void timeoutMessageProcessor(long registrationTime, int id)
    • removeMessages

      public void removeMessages(Object tId, List<MessageIndex> messageIndexes) throws QueueException
      Throws:
      QueueException
    • acknowledgeMessage

      public void acknowledgeMessage(Object tId, MessageIndex messageIndex) throws QueueException
      Throws:
      QueueException
    • acknowledgeMessage

      public void acknowledgeMessage(Object tId, MessageIndex messageIndex, AsyncCompletionCallback callback)
    • acknowledgeMessages

      public void acknowledgeMessages(Object tId, List messageIndexList, AsyncCompletionCallback callback)
    • moveToTransactionReturnSize

      public long moveToTransactionReturnSize(MessageIndex messageIndex, Object sourceTxId, Object destTxId) throws QueueException
      Throws:
      QueueException
    • moveToTransaction

      public void moveToTransaction(MessageIndex messageIndex, Object sourceTxId, Object destTxId) throws QueueException
      Throws:
      QueueException
    • moveToTransactionReturnSize

      public long moveToTransactionReturnSize(MessageIndex messageIndex, Object destTxId) throws QueueException
      Throws:
      QueueException
    • moveToTransaction

      public void moveToTransaction(MessageIndex messageIndex, Object destTxId) throws QueueException
      Throws:
      QueueException
    • hasReceiver

      public boolean hasReceiver(MessageImpl message)
    • putMessage

      public void putMessage(Object tId, MessageImpl message) throws QueueException
      Throws:
      QueueException
    • getQueueIndex

      public SortedSet getQueueIndex() throws QueueException
      Throws:
      QueueException
    • getQueueIndex

      public SortedSet getQueueIndex(int viewId) throws QueueException
      Throws:
      QueueException
    • getMessageByIndex

      public MessageEntry getMessageByIndex(MessageIndex messageIndex) throws QueueException
      Throws:
      QueueException
    • removeMessageByIndex

      public void removeMessageByIndex(MessageIndex messageIndex) throws QueueException
      Throws:
      QueueException
    • getIndexEntry

      public MessageIndex getIndexEntry(MessageIndex messageIndex) throws QueueException
      Throws:
      QueueException
    • deleteContent

      public void deleteContent() throws QueueException
      Throws:
      QueueException
    • lockQueue

      public void lockQueue(Object txId)
    • unlockQueue

      public void unlockQueue(Object txId, boolean markAsyncActive)
    • unmarkAsyncActive

      public void unmarkAsyncActive(Object txId)
    • setCompositeStoreTransaction

      public void setCompositeStoreTransaction(Object txId, CompositeStoreTransaction compositeTx)
    • getCompositeStoreTransaction

      public CompositeStoreTransaction getCompositeStoreTransaction(Object txId)