Package com.nike.pdm.localstack.aws.sqs
Class SqsTaskUtil
- java.lang.Object
-
- com.nike.pdm.localstack.aws.sqs.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.
-
-
-
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; otherwisefalse
-
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 namequeueAttributes
- 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 urlattributeName
- 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 urlattributes
- queue attributes
-
-