Package org.apache.activemq.tool
Class MemMessageIdList
- java.lang.Object
-
- org.apache.activemq.tool.MemMessageIdList
-
- All Implemented Interfaces:
MessageListener
- Direct Known Subclasses:
MemConsumer
public class MemMessageIdList extends Object implements MessageListener
A simple container of messages for performing testing and rendezvous style code. You can use this class aMessageListener
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 thesetParent(MessageListener)
method so that you can aggregate the total number of messages consumed across a number of consumers.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description MemMessageIdList()
MemMessageIdList(Object semaphore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object that)
List<String>
flushMessages()
int
getMessageCount()
List<String>
getMessageIds()
MessageListener
getParent()
int
hashCode()
boolean
hasReceivedMessage()
boolean
hasReceivedMessages(int messageCount)
boolean
isVerbose()
void
onMessage(Message message)
void
setParent(MessageListener parent)
Allows a parent listener to be specified such as to aggregate messages consumed across consumersvoid
setVerbose(boolean verbose)
String
toString()
void
waitForMessagesToArrive(int messageCount)
-
-
-
Constructor Detail
-
MemMessageIdList
public MemMessageIdList()
-
MemMessageIdList
public MemMessageIdList(Object semaphore)
-
-
Method Detail
-
flushMessages
public List<String> flushMessages()
- Returns:
- all the messages on the list so far, clearing the buffer
-
onMessage
public void onMessage(Message message)
- Specified by:
onMessage
in interfaceMessageListener
-
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 MessageListener getParent()
-
setParent
public void setParent(MessageListener parent)
Allows a parent listener to be specified such as to aggregate messages consumed across consumers
-
-