Class SqsTaskUtil


  • public class SqsTaskUtil
    extends java.lang.Object
    Utility methods shared amongst the SQS tasks.
    • Constructor Summary

      Constructors 
      Constructor Description
      SqsTaskUtil​(org.gradle.api.Project project)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.amazonaws.services.sqs.model.CreateQueueResult createQueue​(java.lang.String queueName, java.util.Map<java.lang.String,​java.lang.String> queueAttributes)
      Creates an SQS queue.
      java.lang.Long getApproximateNumberOfMessages​(java.lang.String queueUrl)
      Gets the approximate number of messages on the queue.
      java.lang.String getQueueArnFromName​(java.lang.String queueName)
      Gets the ARN of an SQS queue based on its queue name.
      java.lang.String getQueueAttribute​(java.lang.String queueUrl, java.lang.String attributeName)
      Gets the specified queue attribute if it exists.
      java.lang.String getQueueNameFromUrl​(java.lang.String queueUrl)
      Gets the name of a queue from its queue url.
      java.lang.String getQueueUrl​(java.lang.String queueName)
      Returns the queue url for the queue name.
      java.util.List<java.lang.String> getQueueUrls​(java.util.List<java.lang.String> queueNames)
      Returns a list of resolved queue urls from their queue names.
      boolean queueExists​(java.lang.String queueName)
      Checks if the SQS queue exists.
      void setQueueAttributes​(java.lang.String queueUrl, java.util.Map<java.lang.String,​java.lang.String> attributes)
      Sets the specified attributes on the queue.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SqsTaskUtil

        public SqsTaskUtil​(org.gradle.api.Project project)
    • Method Detail

      • queueExists

        public boolean queueExists​(java.lang.String queueName)
        Checks if the SQS queue exists.
        Parameters:
        queueName - name of the queue
        Returns:
        true if the queue exists; otherwise false
      • getQueueUrls

        public java.util.List<java.lang.String> getQueueUrls​(java.util.List<java.lang.String> queueNames)
        Returns a list of resolved queue urls from their queue names.
        Parameters:
        queueNames - list of queue names to resolve
        Returns:
        list of resolved queue urls
      • getQueueUrl

        public java.lang.String getQueueUrl​(java.lang.String queueName)
        Returns the queue url for the queue name.
        Parameters:
        queueName - queue name
        Returns:
        resolved queue url
      • createQueue

        public com.amazonaws.services.sqs.model.CreateQueueResult createQueue​(java.lang.String queueName,
                                                                              java.util.Map<java.lang.String,​java.lang.String> queueAttributes)
        Creates an SQS queue.
        Parameters:
        queueName - queue name
        queueAttributes - queue attributes
        Returns:
        CreateQueueResult
      • getQueueArnFromName

        public java.lang.String getQueueArnFromName​(java.lang.String queueName)
        Gets the ARN of an SQS queue based on its queue name.
        Parameters:
        queueName - queue name
        Returns:
        queue arn
      • getQueueNameFromUrl

        public java.lang.String getQueueNameFromUrl​(java.lang.String queueUrl)
        Gets the name of a queue from its queue url.
        Parameters:
        queueUrl - queue url
        Returns:
        the name of the queue or an empty string if the queue url is not valid.
      • getApproximateNumberOfMessages

        public java.lang.Long getApproximateNumberOfMessages​(java.lang.String queueUrl)
        Gets the approximate number of messages on the queue.
        Parameters:
        queueUrl - queue url
        Returns:
        approximate number of messaages
      • getQueueAttribute

        public java.lang.String getQueueAttribute​(java.lang.String queueUrl,
                                                  java.lang.String attributeName)
        Gets the specified queue attribute if it exists.
        Parameters:
        queueUrl - queue url
        attributeName - attribute name
        Returns:
        attribute value if it exists; otherwise null
      • setQueueAttributes

        public void setQueueAttributes​(java.lang.String queueUrl,
                                       java.util.Map<java.lang.String,​java.lang.String> attributes)
        Sets the specified attributes on the queue.
        Parameters:
        queueUrl - queue url
        attributes - queue attributes