Software Development

Java – Using Amazon Simple Queue Service (AWS SQS)

This post is about using Amazon Simple Queue Service (SQS) in Java with Eclipse and the AWS Toolkit Plugin. It also demonstrates how to create queues, send messages to and receive messages from them.


Stuff used in this post.

  • AWS Account
  • Fast Internet Connection
  • Eclipse Mars.2 Release (4.5.2)
  • The AWS Toolkit Plugin for Eclipse
  • Java 8 – JDK
  • AWS SDK for Java
    • Version: 1.11.205


AWS SQS and Java

Step 1: Create a Queue

There are more than 1 way to create a queue depending on the requirements. It may be created in AWS Management Console, in Eclipse (using AWS Toolkit Plugin), and codes.

In AWS Management Console

Using the AWS Toolkit Plugin

In Java


Step 2: Create a AWS Project

Go to File > Other...

Choose AWS Java Project and click Next.

Provide Project name, Group ID, and Artifact ID. Ignore the checkboxes in the AWS SDK for Java Samples. Then, click Finish.


Wait until the creation process completes.

Step 3: Create simple Java codes

Codes to send Messages to a Queue

The following are simple Java codes that send a message to our SQS queue in the cloud.

This outputs the following in the console.

We now have a message in the queue.


Codes to read Messages from a Queue

The following are simple Java codes that retrieves the messages from our SQS queue in the cloud.

This outputs:


Our queue will be empty.

Download the codes


  1. AWS SDK for Java
  2. Working with Amazon SQS Message Queues

Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like