MATLAB® interface for the Amazon SQS™ service.
- Requires MATLAB release R2017a or later.
- AWS Common utilities found at https://github.com/mathworks-ref-arch/matlab-aws-common
- (Recommended) MATLAB Interface for Amazon SNS™ found at https://github.com/mathworks-ref-arch/matlab-aws-sns
- Amazon Web Services account
To build a required JAR file:
- Maven
- JDK 7
- AWS SDK for Java (version 1.11.567 or later)
Please refer to the Documentation to get started. The Installation Instructions and Getting Started documents provide detailed instructions on setting up and using the interface. The easiest way to fetch this repo and all required dependencies is to clone the top-level repository using:
git clone --recursive https://github.com/mathworks-ref-arch/mathworks-aws-support.git
The MATLAB code uses the AWS SDK for Java and can be built using:
cd Software/Java
mvn clean package
Once built, use the /Software/MATLAB/startup.m
function to initialize the interface which will use the
AWS Credentials Provider Chain to authenticate. Please see the relevant documentation
on how to specify the credentials.
% Create the client called sqs
sqs = aws.sqs.Client();
% use a JSON credentials file
sqs.useCredentialsProviderChain = false;
sqs.initialize();
% create a Queue, note AWS provides naming guidelines
QueueName = 'com-example-myQueue';
createQueueResult = sqs.createQueue(QueueName);
queueUrl = createQueueResult.getQueueUrl();
% get a list of the Queues and see that com-example-myQueue appears
listQueueResult = sqs.listQueues();
urlList = listQueueResult.getQueueUrls();
% send a message to the queue
sendMessageResult = sqs.sendMessage(queueUrl, 'My SQS Message');
sentMessageId = sendMessageResult.getMessageId();
% Receive messages from the queue
receiveMessageResult = sqs.receiveMessage(queueUrl);
messages = receiveMessageResult.getMessages();
% Get Id, receiptHandle and body of each message
for n = 1:numel(messages)
messageId = messages{n}.getMessageId();
receiptHandle = messages{n}.getReceiptHandle();
body = messages{n}.getBody();
end
% cleanup by deleting the Queue and shutting down the client
deleteQueueResult = sqs.deleteQueue(queueUrl);
sqs.shutdown;
- MATLAB (R2017a or later)
- MATLAB Compiler™ and MATLAB Compiler SDK™ (R2017a or later)
- MATLAB Production Server™ (R2017a or later)
- MATLAB Parallel Server™ (R2017a or later)
The license for the MATLAB Interface for Amazon SQS is available in the LICENSE.md file in this GitHub repository. This package uses certain third-party content which is licensed under separate license agreements. See the pom.xml file for third-party software downloaded at build time.
Provide suggestions for additional features or capabilities using the following link:
https://www.mathworks.com/products/reference-architectures/request-new-reference-architectures.html
Email: mwlab@mathworks.com
or please log an issue.