@RequiresEnterpriseLicense(allowEval=true) @Connector(name="sqs", friendlyName="Amazon SQS", minMuleVersion="3.6") public class SQSConnector extends Object
Constructor and Description |
---|
SQSConnector() |
Modifier and Type | Method and Description |
---|---|
void |
addPermission(String label,
List<String> accountIds,
List<String> actions,
String queueUrl)
Adds a permission to this message queue.
|
void |
changeMessageVisibility(String receiptHandle,
Integer visibilityTimeout,
String queueUrl)
Changes the visibility timeout of a specified message in a queue to a new value.
|
ChangeMessageVisibilityBatchResult |
changeMessageVisibilityBatch(List<ChangeMessageVisibilityBatchRequestEntry> receiptHandles,
String queueUrl)
Changes the visibility timeout of multiple messages.
|
CreateQueueResult |
createQueue(String queueName,
RegionEndpoint region,
Map<String,String> attributes)
Creates a new queue, or returns the URL of an existing one.
|
void |
deleteMessage(String receiptHandle,
String queueUrl)
Deletes the message identified by message object on the queue this object represents.
|
DeleteMessageBatchResult |
deleteMessageBatch(List<DeleteMessageBatchRequestEntry> receiptHandles,
String queueUrl)
Deletes up to ten messages from the specified queue.
|
void |
deleteQueue(String queueUrl)
Deletes the message queue represented by this object.
|
int |
getApproximateNumberOfMessages(String queueUrl)
Gets an approximate number of visible messages for a queue.
|
SQSCommonConfig |
getConfig() |
GetQueueAttributesResult |
getQueueAttributes(List<String> attributeNames,
String queueUrl)
Gets queue attributes.
|
GetQueueUrlResult |
getQueueUrl(String queueName,
String queueOwnerAWSAccountId)
Returns the URL of an existing queue.
|
ListDeadLetterSourceQueuesResult |
listDeadLetterSourceQueues(String queueUrl)
Returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead letter queue.
|
ListQueuesResult |
listQueues(String queueNamePrefix)
Returns a list of your queues.
|
void |
purgeQueue(String queueUrl)
Deletes the messages in a queue specified by the queue URL.
|
void |
receiveMessages(org.mule.api.callback.SourceCallback callback,
Integer visibilityTimeout,
Boolean preserveMessages,
Integer numberOfMessages,
String queueUrl)
Attempts to receive messages from a queue.
|
void |
removePermission(String label,
String queueUrl)
Removes a permission from this message queue.
|
SendMessageResult |
sendMessage(Message message,
String queueUrl)
Sends a message to a specified queue.
|
SendMessageBatchResult |
sendMessageBatch(List<SendMessageBatchRequestEntry> messages,
String queueUrl)
Delivers up to ten messages to the specified queue.
|
void |
setConfig(SQSCommonConfig config) |
void |
setQueueAttributes(Map<String,String> attributes,
String queueUrl)
Sets the value of one or more queue attributes.
|
@Processor public void addPermission(String label, List<String> accountIds, List<String> actions, @Optional String queueUrl) throws SQSConnectorException
label
- a name for this permissionaccountIds
- the AWS account ID's for the account to share this queue withactions
- a list to indicate how much to share (SendMessage, ReceiveMessage, ChangeMessageVisibility, DeleteMessage, GetQueueAttributes)queueUrl
- Permissions will be added to the queue represented by this URL.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public void changeMessageVisibility(@Default(value="#[header:inbound:sqs.message.receipt.handle]") String receiptHandle, Integer visibilityTimeout, @Optional String queueUrl) throws SQSConnectorException
receiptHandle
- The receipt handle associated with the message whose visibility timeout should be changed.visibilityTimeout
- The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.queueUrl
- The URL of the Amazon SQS queue to take action on.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(@Default(value="#[payload]") List<ChangeMessageVisibilityBatchRequestEntry> receiptHandles, @Optional String queueUrl) throws SQSConnectorException
receiptHandles
- A list of receipt handles of the messages for which the visibility timeout must be changed.queueUrl
- The URL of the Amazon SQS queue to take action on.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public CreateQueueResult createQueue(String queueName, @Optional RegionEndpoint region, @Default(value="#[payload]") Map<String,String> attributes) throws SQSConnectorException
queueName
- The name for the queue to be created.region
- The region in which the queue to be created.attributes
- A map of attributes with their corresponding values. Valid Map Keys: Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod |
ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed |
DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicySQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public void deleteMessage(@Default(value="#[header:inbound:sqs.message.receipt.handle]") String receiptHandle, @Optional String queueUrl) throws SQSConnectorException
receiptHandle
- Receipt handle of the message to be deletedqueueUrl
- The URL of the queue to delete messages fromSQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public DeleteMessageBatchResult deleteMessageBatch(@Default(value="#[payload]") List<DeleteMessageBatchRequestEntry> receiptHandles, @Optional String queueUrl) throws SQSConnectorException
receiptHandles
- A list of receipt handles for the messages to be deleted.queueUrl
- The URL of the queue to delete messages as a batch from.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public void deleteQueue(@Optional String queueUrl) throws SQSConnectorException
queueUrl
- The URL of the queue to delete.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public GetQueueAttributesResult getQueueAttributes(@Default(value="#[payload]") List<String> attributeNames, @Optional String queueUrl) throws SQSConnectorException
attributeNames
- A list of attribute retrieve information for.queueUrl
- The URL of the Amazon SQS queue to take action on.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public GetQueueUrlResult getQueueUrl(String queueName, @Optional String queueOwnerAWSAccountId) throws SQSConnectorException
queueName
- The name of the queue whose URL must be fetched.queueOwnerAWSAccountId
- The AWS account ID of the owner that created the queue.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public ListDeadLetterSourceQueuesResult listDeadLetterSourceQueues(@Optional String queueUrl) throws SQSConnectorException
queueUrl
- The queue URL of a dead letter queue.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public ListQueuesResult listQueues(@Optional String queueNamePrefix) throws SQSConnectorException
queueNamePrefix
- A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public void purgeQueue(@Optional String queueUrl) throws SQSConnectorException
queueUrl
- the queue URL where messages are to be fetched from.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Source(sourceStrategy=POLLING, pollingPeriod=5000L) @ReconnectOn(exceptions=SQSConnectionException.class) public void receiveMessages(org.mule.api.callback.SourceCallback callback, @Default(value="30") Integer visibilityTimeout, @Default(value="false") Boolean preserveMessages, @Default(value="1") Integer numberOfMessages, @Optional String queueUrl) throws SQSConnectorException, org.mule.api.MessagingException, InterruptedException
callback
- Callback to call when new messages are available.visibilityTimeout
- the duration (in seconds) the retrieved messages are hidden from subsequent calls to retrieve.preserveMessages
- Flag that indicates if you want to preserve the messages in the queue. False by default, so the messages are going to be deleted.numberOfMessages
- the number of messages to be retrieved on each call (10 messages max). By default, 1 message will be retrieved.queueUrl
- the queue URL where messages are to be fetched from.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.SQSConnectionException
org.mule.api.MessagingException
InterruptedException
@Processor public void removePermission(String label, @Optional String queueUrl) throws SQSConnectorException
label
- a name for the permission to be removedqueueUrl
- Permissions will be deleted from the queue represented by this URL.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public SendMessageResult sendMessage(@Default(value="#[payload]") Message message, @Optional String queueUrl) throws SQSConnectorException
message
- Container for the parameters to the sendmessage operation.queueUrl
- the queue where the message is to be sent.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public SendMessageBatchResult sendMessageBatch(@Default(value="#[payload]") List<SendMessageBatchRequestEntry> messages, @Optional String queueUrl) throws SQSConnectorException
queueUrl
- the queue where the message is to be sent.messages
- A list of SendMessageBatchRequestEntry items.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public void setQueueAttributes(@Default(value="#[payload]") Map<String,String> attributes, @Optional String queueUrl) throws SQSConnectorException
attributes
- A map of attributes to set.queueUrl
- The URL of the queue.SQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@Processor public int getApproximateNumberOfMessages(@Optional String queueUrl) throws SQSConnectorException
queueUrl
- The URL of the queueSQSConnectorException
- If any internal errors are encountered inside the connector while attempting to make the request or handle the response. For example if a network connection is
not available.@NotNull public SQSCommonConfig getConfig()
public void setConfig(@NotNull SQSCommonConfig config)
Copyright © 2010–2020. All rights reserved.