This is a companion source code for Amazon Compute Blog - Enhancing message-based applications with Message Attributes. The samples in this project demonstrate how to use Message Attributes feature of Amazon Simple Queue Service (SQS).
- JDK 8 or above
- IDE for e.g. Eclipse or Spring Tools or Intellij IDEA
- Apache Maven
- Access to AWS Environment
- 1 Amazon SQS Queue of type Standard
- 1 Amazon SQS Queue of type FIFO
- Clone this starter kit to your Laptop / MacBook
- It has Maven nature, so you can import it to your IDE
- Create an SQS queue of type Standard. Make a note of its URL and update relevant Java classes per inline instructions in the code
- Create an SQS queue of type FIFO. Make a note of its URL and update relevant Java classes per inline instructions in the code
Class | Purpose |
---|---|
SendMessageWithAttributes.java | Send message attributes to a standard queue. |
SendMessageWithAttributes_FIFO.java | Send message attributes to a FIFO queue. |
SendMessageWithAttributes_AWSXRay_Tracing.java | Send message attributes to a standard queue and with AWS X-Ray Tracing enabled. |
SendMessageWithAttributes_AWSXRay_Tracing_FIFO.java | Send message attributes to a FIFO queue and with AWS X-Ray Tracing enabled. |
ReceiveMessage.java | Receive message from a standard queue. |
ReceiveMessage_FIFO.java | Receive message from a FIFO queue. |
ReceiveMessage_AWSXRay_Tracing.java | Receive message from a standard queue and print AWSTraceHeader. |
- Update Java classes with appropriate SQS queue URL
- Run the programs in your IDE
Amazon SQS, Message Attributes
This sample code is made available under the MIT license. See the LICENSE file.