aws / aws/aws-dotnet-messaging

Message Middleware

Open
#218 2 comments 3 reactions 1 assignee Assigned to @normj View on GitHub
feature-request l p2
Dominant language
C#
Stars
143
Forks
27
Avg merge
1d 18h
Merged PRs (30d)
4

Description

### Describe the feature

It would be very helpful if `aws-dotnet-messaging` supported message middleware (or interceptors) that can be executed when sending or receiving messages to/from the broker. This middleware should allow custom logic to run before or after message publication and processing, similar to ASP.NET middleware or the pipeline in MediatR.

Middleware could be implemented as a chain or pipeline of delegates that operate on the message context, allowing users to perform cross-cutting concerns such as:

* Logging
* Message Enrichment
* Retry logic

Note: Currently, implementing these behaviors is quite difficult because the library makes some of its core classes internal, such as `SQSPublisher` and `EnvelopeSerializer`, this limits the customization.

### Use Case

- **Custom Retry Policies:**
Adding logic to retry messages under certain conditions, such as transient database exception.
- **Logging & Auditing:**
Logging message metadata or contents for auditing purposes, both on the producer and consumer sides.
- **Message Enrichment or Transformation:**
Modifying message headers before they are sent, or before they are processed.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS.Messaging (or related) package versions

AWS.Messaging 0.9.5

### Targeted .NET Platform

All

### Operating System and version

All

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.