org.apache.activemq.broker.region
Class Queue

java.lang.Object
  extended by org.apache.activemq.broker.region.Queue
All Implemented Interfaces:
Destination, Service

public class Queue
extends Object
implements Destination

The Queue is a List of MessageEntry objects that are dispatched to matching subscriptions.

Version:
$Revision: 1.28 $

Field Summary
protected  List consumers
           
protected  ActiveMQDestination destination
           
protected  DestinationStatistics destinationStatistics
           
protected  Valve dispatchValve
           
protected  long garbageSize
           
protected  long garbageSizeBeforeCollection
           
protected  int highestSubscriptionPriority
           
protected  PendingMessageCursor messages
           
protected  MessageStore store
           
protected  UsageManager usageManager
           
 
Constructor Summary
Queue(ActiveMQDestination destination, UsageManager memoryManager, MessageStore store, DestinationStatistics parentStats, TaskRunnerFactory taskFactory)
           
 
Method Summary
 void acknowledge(ConnectionContext context, Subscription sub, MessageAck ack, MessageReference node)
           
 void addSubscription(ConnectionContext context, Subscription sub)
           
 Message[] browse()
           
 int copyMatchingMessages(ConnectionContext context, MessageReferenceFilter filter, ActiveMQDestination dest, int maximumMessages)
          Copies the messages matching the given filter up to the maximum number of matched messages
 int copyMatchingMessagesTo(ConnectionContext context, String selector, ActiveMQDestination dest)
          Copies the messages matching the given selector
 int copyMatchingMessagesTo(ConnectionContext context, String selector, ActiveMQDestination dest, int maximumMessages)
          Copies the messages matching the given selector up to the maximum number of matched messages
 boolean copyMessageTo(ConnectionContext context, String messageId, ActiveMQDestination dest)
          Copies the message matching the given messageId
protected  ConnectionContext createConnectionContext()
           
protected  MessageReferenceFilter createMessageIdFilter(String messageId)
           
protected  MessageReferenceFilter createSelectorFilter(String selector)
           
 void dispose(ConnectionContext context)
           
 void dropEvent()
           
 void dropEvent(boolean skipGc)
           
 void gc()
           
 ActiveMQDestination getActiveMQDestination()
           
 DeadLetterStrategy getDeadLetterStrategy()
           
 String getDestination()
           
 DestinationStatistics getDestinationStatistics()
           
 DispatchPolicy getDispatchPolicy()
           
 Message getMessage(String messageId)
           
 MessageGroupMapFactory getMessageGroupMapFactory()
           
 MessageGroupMap getMessageGroupOwners()
           
 PendingMessageCursor getMessages()
           
 String getName()
           
 UsageManager getUsageManager()
           
 void initialize()
           
 boolean lock(MessageReference node, LockOwner lockOwner)
           
protected  boolean lockMessage(IndirectMessageReference r)
           
 int moveMatchingMessagesTo(ConnectionContext context, MessageReferenceFilter filter, ActiveMQDestination dest, int maximumMessages)
          Moves the messages matching the given filter up to the maximum number of matched messages
 int moveMatchingMessagesTo(ConnectionContext context, String selector, ActiveMQDestination dest)
          Moves the messages matching the given selector
 int moveMatchingMessagesTo(ConnectionContext context, String selector, ActiveMQDestination dest, int maximumMessages)
          Moves the messages matching the given selector up to the maximum number of matched messages
 boolean moveMessageTo(ConnectionContext context, String messageId, ActiveMQDestination dest)
          Moves the message matching the given messageId
 void purge()
           
 int removeMatchingMessages(MessageReferenceFilter filter, int maximumMessages)
          Removes the messages matching the given filter up to the maximum number of matched messages
 int removeMatchingMessages(String selector)
          Removes the messages matching the given selector
 int removeMatchingMessages(String selector, int maximumMessages)
          Removes the messages matching the given selector up to the maximum number of matched messages
protected  void removeMessage(ConnectionContext c, IndirectMessageReference r)
           
 boolean removeMessage(String messageId)
          Removes the message matching the given messageId
 void removeSubscription(ConnectionContext context, Subscription sub)
           
 void send(ConnectionContext context, Message message)
           
 void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy)
           
 void setDispatchPolicy(DispatchPolicy dispatchPolicy)
           
 void setMessageGroupMapFactory(MessageGroupMapFactory messageGroupMapFactory)
           
 void setMessages(PendingMessageCursor messages)
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

destination

protected final ActiveMQDestination destination

consumers

protected final List consumers

dispatchValve

protected final Valve dispatchValve

usageManager

protected final UsageManager usageManager

destinationStatistics

protected final DestinationStatistics destinationStatistics

messages

protected PendingMessageCursor messages

garbageSize

protected long garbageSize

garbageSizeBeforeCollection

protected long garbageSizeBeforeCollection

store

protected final MessageStore store

highestSubscriptionPriority

protected int highestSubscriptionPriority
Constructor Detail

Queue

public Queue(ActiveMQDestination destination,
             UsageManager memoryManager,
             MessageStore store,
             DestinationStatistics parentStats,
             TaskRunnerFactory taskFactory)
      throws Exception
Throws:
Exception
Method Detail

initialize

public void initialize()
                throws Exception
Throws:
Exception

lock

public boolean lock(MessageReference node,
                    LockOwner lockOwner)
Specified by:
lock in interface Destination

addSubscription

public void addSubscription(ConnectionContext context,
                            Subscription sub)
                     throws Exception
Specified by:
addSubscription in interface Destination
Throws:
Exception

removeSubscription

public void removeSubscription(ConnectionContext context,
                               Subscription sub)
                        throws Exception
Specified by:
removeSubscription in interface Destination
Throws:
Exception

send

public void send(ConnectionContext context,
                 Message message)
          throws Exception
Specified by:
send in interface Destination
Throws:
Exception

dispose

public void dispose(ConnectionContext context)
             throws IOException
Specified by:
dispose in interface Destination
Throws:
IOException

dropEvent

public void dropEvent()

dropEvent

public void dropEvent(boolean skipGc)

gc

public void gc()
Specified by:
gc in interface Destination

acknowledge

public void acknowledge(ConnectionContext context,
                        Subscription sub,
                        MessageAck ack,
                        MessageReference node)
                 throws IOException
Specified by:
acknowledge in interface Destination
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

start

public void start()
           throws Exception
Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Service
Throws:
Exception

getActiveMQDestination

public ActiveMQDestination getActiveMQDestination()
Specified by:
getActiveMQDestination in interface Destination

getDestination

public String getDestination()

getUsageManager

public UsageManager getUsageManager()
Specified by:
getUsageManager in interface Destination

getDestinationStatistics

public DestinationStatistics getDestinationStatistics()
Specified by:
getDestinationStatistics in interface Destination

getMessageGroupOwners

public MessageGroupMap getMessageGroupOwners()

getDispatchPolicy

public DispatchPolicy getDispatchPolicy()

setDispatchPolicy

public void setDispatchPolicy(DispatchPolicy dispatchPolicy)

getDeadLetterStrategy

public DeadLetterStrategy getDeadLetterStrategy()
Specified by:
getDeadLetterStrategy in interface Destination

setDeadLetterStrategy

public void setDeadLetterStrategy(DeadLetterStrategy deadLetterStrategy)

getMessageGroupMapFactory

public MessageGroupMapFactory getMessageGroupMapFactory()

setMessageGroupMapFactory

public void setMessageGroupMapFactory(MessageGroupMapFactory messageGroupMapFactory)

getName

public String getName()
Specified by:
getName in interface Destination

getMessages

public PendingMessageCursor getMessages()

setMessages

public void setMessages(PendingMessageCursor messages)

browse

public Message[] browse()
Specified by:
browse in interface Destination

getMessage

public Message getMessage(String messageId)

purge

public void purge()

removeMessage

public boolean removeMessage(String messageId)
                      throws Exception
Removes the message matching the given messageId

Throws:
Exception

removeMatchingMessages

public int removeMatchingMessages(String selector)
                           throws Exception
Removes the messages matching the given selector

Returns:
the number of messages removed
Throws:
Exception

removeMatchingMessages

public int removeMatchingMessages(String selector,
                                  int maximumMessages)
                           throws Exception
Removes the messages matching the given selector up to the maximum number of matched messages

Returns:
the number of messages removed
Throws:
Exception

removeMatchingMessages

public int removeMatchingMessages(MessageReferenceFilter filter,
                                  int maximumMessages)
                           throws Exception
Removes the messages matching the given filter up to the maximum number of matched messages

Returns:
the number of messages removed
Throws:
Exception

copyMessageTo

public boolean copyMessageTo(ConnectionContext context,
                             String messageId,
                             ActiveMQDestination dest)
                      throws Exception
Copies the message matching the given messageId

Throws:
Exception

copyMatchingMessagesTo

public int copyMatchingMessagesTo(ConnectionContext context,
                                  String selector,
                                  ActiveMQDestination dest)
                           throws Exception
Copies the messages matching the given selector

Returns:
the number of messages copied
Throws:
Exception

copyMatchingMessagesTo

public int copyMatchingMessagesTo(ConnectionContext context,
                                  String selector,
                                  ActiveMQDestination dest,
                                  int maximumMessages)
                           throws Exception
Copies the messages matching the given selector up to the maximum number of matched messages

Returns:
the number of messages copied
Throws:
Exception

copyMatchingMessages

public int copyMatchingMessages(ConnectionContext context,
                                MessageReferenceFilter filter,
                                ActiveMQDestination dest,
                                int maximumMessages)
                         throws Exception
Copies the messages matching the given filter up to the maximum number of matched messages

Returns:
the number of messages copied
Throws:
Exception

moveMessageTo

public boolean moveMessageTo(ConnectionContext context,
                             String messageId,
                             ActiveMQDestination dest)
                      throws Exception
Moves the message matching the given messageId

Throws:
Exception

moveMatchingMessagesTo

public int moveMatchingMessagesTo(ConnectionContext context,
                                  String selector,
                                  ActiveMQDestination dest)
                           throws Exception
Moves the messages matching the given selector

Returns:
the number of messages removed
Throws:
Exception

moveMatchingMessagesTo

public int moveMatchingMessagesTo(ConnectionContext context,
                                  String selector,
                                  ActiveMQDestination dest,
                                  int maximumMessages)
                           throws Exception
Moves the messages matching the given selector up to the maximum number of matched messages

Throws:
Exception

moveMatchingMessagesTo

public int moveMatchingMessagesTo(ConnectionContext context,
                                  MessageReferenceFilter filter,
                                  ActiveMQDestination dest,
                                  int maximumMessages)
                           throws Exception
Moves the messages matching the given filter up to the maximum number of matched messages

Throws:
Exception

createMessageIdFilter

protected MessageReferenceFilter createMessageIdFilter(String messageId)

createSelectorFilter

protected MessageReferenceFilter createSelectorFilter(String selector)
                                               throws javax.jms.InvalidSelectorException
Throws:
javax.jms.InvalidSelectorException

removeMessage

protected void removeMessage(ConnectionContext c,
                             IndirectMessageReference r)
                      throws IOException
Throws:
IOException

lockMessage

protected boolean lockMessage(IndirectMessageReference r)

createConnectionContext

protected ConnectionContext createConnectionContext()


Copyright © 2011 Apache Software Foundation. All Rights Reserved.