This is a Spring Boot 3 application demonstrating an order processing system using AWS DynamoDB, SQS, and SNS. The application includes a simple UI to create and view orders.
- Java 17 or higher
- Maven 3.6.3 or higher
- AWS CLI configured with appropriate credentials and region
- Local DynamoDB setup (optional, if you prefer to run DynamoDB locally)
- AWS Account with permissions to create and manage DynamoDB, SQS, and SNS resources
The application uses a DynamoDB table named Orders
with orderId
as the partition key. You can create this table using the AWS CLI:
aws dynamodb create-table \
--table-name Orders \
--attribute-definitions AttributeName=orderId,AttributeType=S \
--key-schema AttributeName=orderId,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
--region ap-southeast-2
The application uses an SQS queue named OrderQueue for order processing. Create this queue using the AWS CLI:
aws sqs create-queue --queue-name OrderQueue --region ap-southeast-2
The application uses an SNS topic named OrderNotifications to send notifications when an order is created. Create this topic using the AWS CLI:
aws sns create-topic --name OrderNotifications --region ap-southeast-2
You can also subscribe to this topic to receive notifications via email or SMS.
aws sns subscribe --topic-arn arn:aws:sns:ap-southeast-2:YOUR_AWS_ACCOUNT_ID:OrderNotifications \
--protocol email --notification-endpoint your-email@example.com --region ap-southeast-2
Note: Replace YOUR_AWS_ACCOUNT_ID, your-email@example.com, and +1234567890 with your actual AWS account ID, email, and phone number, respectively.
- Clone the repository:
git clone https://github.com/your-username/order-processing-demo.git
cd order-processing-demo
- Configure AWS Credentials: Ensure that your AWS credentials are configured correctly. You can do this by running:
aws configure
- Run the application:
mvn spring-boot:run
-
Access the UI: Open a web browser and navigate to
http://localhost:8080
to access the application. -
Running in offline/test mode
Add testmode: true
to the application.yml
to enable an offline mode using a mock service.
- DynamoDB Local: If you prefer to run DynamoDB locally, ensure you update the application.yml with the appropriate endpoint URL.
- Security: Avoid committing AWS credentials or other sensitive information to your repository. Use environment variables or AWS IAM roles for secure access.