aws-sqs-thread-examples is an aws sdk java examples for Aws Simple Queue Service
- QueueSender.java send a simple message to the queue
- SingleThreadQueueReceiver.java Take out the message from the queue in a single thread .
- MultiThreadQueueReceiver.java Take out the message from the queue in a multi thread .
- Java8
- AWS Account
$ git clone https://github.com/uzresk/aws-sqs-thead-examples.git
1.Create a queue named "MyQueue".
2.To get the access key secret access key for accessing the AWS
3.grant permissions to the queue using the IAM
Please set to get the access key secret access key AwsCredentials.properties.
accessKey=XXXXXXXXXXXXXXXXXXX
secretKey=XXXXXXXXXXXXXXXXXXX
public class AwsClientProvider {
public static AmazonSQS createSQSClient() {
AWSCredentialsProvider provider = new ClasspathPropertiesFileCredentialsProvider();
ClientConfiguration cc = new ClientConfiguration();
// cc.setProxyHost("PROXY_HOST");
// cc.setProxyPort(PROXY_PORT);
AmazonSQS sqs = new AmazonSQSClient(provider, cc);
sqs.setRegion(Region.getRegion(Regions.AP_NORTHEAST_1));
return sqs;
}
}
- QueueSender
- SingleThreadQueueReceiver or MultiThreadQueueReceiver