Class QueueHelper


  • public class QueueHelper
    extends Object
    Helper class for queue handling.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • QueueHelper

        public QueueHelper()
    • Method Detail

      • hasQueue

        public static boolean hasQueue​(Actor actor,
                                       StorageName queue)
        Checks whether the specified queue is available.
        Parameters:
        actor - the actor to check for
        queue - the name of the queue
        Returns:
        true if available
      • getQueue

        public static StorageQueueHandler getQueue​(Actor actor,
                                                   StorageName queue)
        Returns the specified queue.
        Parameters:
        actor - the actor to obtain the queue for
        queue - the name of the queue
        Returns:
        the queue handler, null if not available
      • enqueue

        public static boolean enqueue​(Actor actor,
                                      StorageName queue,
                                      Object payload)
        Queues the payload in the specified queue.
        Parameters:
        actor - the actor to obtain the queue for
        queue - the name of the queue
        payload - the data to queue
        Returns:
        true if successfully queued
      • enqueueDelayedBy

        public static boolean enqueueDelayedBy​(Actor actor,
                                               StorageName queue,
                                               Object payload,
                                               long retrievalDelay)
        Queues the payload in the specified queue, applying the specified retrieval delay.
        Parameters:
        actor - the actor to obtain the queue for
        queue - the name of the queue
        payload - the data to queue
        retrievalDelay - the delay to enforce on this object
        Returns:
        true if successfully queued
      • enqueueDelayedAt

        public static boolean enqueueDelayedAt​(Actor actor,
                                               StorageName queue,
                                               Object payload,
                                               long retrievalAt)
        Queues the payload in the specified queue, applying the specified retrieval timestamp.
        Parameters:
        actor - the actor to obtain the queue for
        queue - the name of the queue
        payload - the data to queue
        retrievalAt - the delay to enforce on this object
        Returns:
        true if successfully queued