Class MemMessageIdList

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class MemMessageIdList
    extends Object
    implements 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.

    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
    • Constructor Detail

      • MemMessageIdList

        public MemMessageIdList()
      • MemMessageIdList

        public MemMessageIdList​(Object semaphore)
    • Method Detail

      • hashCode

        public int hashCode()
        hashCode in class Object
      • flushMessages

        public List<String> flushMessages()
        all the messages on the list so far, clearing the buffer
      • getMessageIds

        public List<String> getMessageIds()
      • 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)
      • setParent

        public void setParent​(MessageListener parent)
        Allows a parent listener to be specified such as to aggregate messages consumed across consumers