Class MockQueue

  • All Implemented Interfaces:
    Queue

    @Singleton
    public class MockQueue
    extends Object
    implements Queue
    Author:
    Alex Bogdanovski [alex@erudika.com]
    • Constructor Detail

      • MockQueue

        public MockQueue()
        Default constructor.
      • MockQueue

        public MockQueue​(String name)
        Parameters:
        name - name
    • Method Detail

      • pull

        public String pull()
        Description copied from interface: Queue
        Pulls one or more messages from a queue.
        Specified by:
        pull in interface Queue
        Returns:
        the message
      • push

        public void push​(String task)
        Description copied from interface: Queue
        Pushes a message to a queue.
        Specified by:
        push in interface Queue
        Parameters:
        task - the message
      • getName

        public String getName()
        Description copied from interface: Queue
        Returns the name of the queue.
        Specified by:
        getName in interface Queue
        Returns:
        the queue name
      • setName

        public void setName​(String name)
        Description copied from interface: Queue
        Sets the name of the queue.
        Specified by:
        setName in interface Queue
        Parameters:
        name - a name
      • startPolling

        public void startPolling()
        Description copied from interface: Queue
        Start a new async task which polls the queue and automatically processes the messages. This was inspired by Elasticsearch rivers.
        Specified by:
        startPolling in interface Queue
      • stopPolling

        public void stopPolling()
        Description copied from interface: Queue
        Stops the polling async task manually. This method should always be called on shutdown.
        Specified by:
        stopPolling in interface Queue