org.apache.activemq.tool
Class MemMessageIdList
java.lang.Object
org.apache.activemq.tool.MemMessageIdList
- All Implemented Interfaces:
- javax.jms.MessageListener
- Direct Known Subclasses:
- MemConsumer
public class MemMessageIdList
- extends java.lang.Object
- implements javax.jms.MessageListener
A simple container of messages for performing testing and rendezvous style
code. You can use this class a MessageListener
and then make
assertions about how many messages it has received allowing a certain maximum
amount of time to ensure that the test does not hang forever.
Also you can chain these instances together with the
setParent(MessageListener)
method so that you can aggregate the
total number of messages consumed across a number of consumers.
- Version:
- $Revision: 1.6 $
Field Summary |
protected static org.apache.commons.logging.Log |
log
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
log
protected static final org.apache.commons.logging.Log log
MemMessageIdList
public MemMessageIdList()
MemMessageIdList
public MemMessageIdList(java.lang.Object semaphore)
equals
public boolean equals(java.lang.Object that)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
flushMessages
public java.util.List flushMessages()
- Returns:
- all the messages on the list so far, clearing the buffer
getMessageIds
public java.util.List getMessageIds()
onMessage
public void onMessage(javax.jms.Message message)
- Specified by:
onMessage
in interface javax.jms.MessageListener
getMessageCount
public int getMessageCount()
waitForMessagesToArrive
public void waitForMessagesToArrive(int messageCount)
hasReceivedMessage
public boolean hasReceivedMessage()
hasReceivedMessages
public boolean hasReceivedMessages(int messageCount)
isVerbose
public boolean isVerbose()
setVerbose
public void setVerbose(boolean verbose)
getParent
public javax.jms.MessageListener getParent()
setParent
public void setParent(javax.jms.MessageListener parent)
- Allows a parent listener to be specified such as to aggregate messages
consumed across consumers
Copyright © 2011 Apache Software Foundation. All Rights Reserved.