graph TD;
A[.NET Service A] -->|Publish Message| B[AWS SNS Topic]
B -->|Subscribe| D[AWS SQS Queue 1]
B -->|Subscribe| E[AWS SQS Queue 2]
D -->|Consume| G[.NET Service B]
E -->|Consume| H[.NET Service C]
This project demonstrates a minimal setup to use AWS SNS and SQS with .NET. It includes examples for publishing messages to an SNS topic, subscribing an SQS queue to that topic, and consuming messages from the queue.
- .NET Core 3.1 or higher
- AWS CLI configured with appropriate permissions
- AWS SDK for .NET (
AWSSDK.Core
,AWSSDK.SNS
,AWSSDK.SQS
)
-
Clone the repository:
git clone [email protected]:JustJordanT/communication-dotnet-aws-sns-sqs.git
-
Navigate to the project directory:
cd dotnet-aws-sns-sqs-example
-
Restore the project:
dotnet restore
-
Rename the
appsettings.json.example
file toappsettings.json
and fill in the required AWS credentials and configurations.{ "AWS": { "Region": "your-aws-region", "AccessKeyId": "your-access-key-id", "SecretAccessKey": "your-secret-access-key" }, "SNS": { "TopicARN": "your-sns-topic-arn" }, "SQS": { "QueueURL": "your-sqs-queue-url" } }
Run the following command to publish a message to the SNS topic:
dotnet run --project ./src/Publish
Run the following command to start consuming messages from the SQS queue:
dotnet run --project ./src/Consume
- Fork the repository.
- Create a new feature branch.
- Make your changes.
- Submit a pull request.
For more details, see CONTRIBUTING.md.
This project is licensed under the MIT License. See LICENSE.md for details.
Feel free to adapt this README to better suit your project's specific needs.