Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to receive messages from SQS queue unless the message subject matches with model class GetType().Name #957

Open
punyap181 opened this issue Nov 9, 2021 · 4 comments
Milestone

Comments

@punyap181
Copy link

Our application wants to receive SES event notifications. These notifications are sent from SES to SNS and then to SQS. We are trying to read messages from the SQS queue.

SES notification message looks like this :

{
"Type" : "Notification",
"MessageId" : "6d3fa15a-f085-52b3-aa59-fb59bd88dce7",
"TopicArn" : "arn:aws:sns:eu-west-1:test:test",
"Subject" : "Amazon SES Email Event Notification",
"Message" : "{"eventType":"Open","mail":.........}

Here the message subject is "Amazon SES Email Event Notification" which is something AWS provides and is not customizable.

We have created the model class with name "AmazonSESEmailEventNotification" .. since the subject and class name are not matching, handler is not picking up the queue messages. But if i manually publish a message with subject same as classname from the queue , handler is able to pick it up and is working fine.

I appreciate any help to solve this issue

@punyap181 punyap181 changed the title Not able to receive messages from SQS queue unless the message subject matched with model class GetType().Name Not able to receive messages from SQS queue unless the message subject matches with model class GetType().Name Nov 9, 2021
@punyap181
Copy link
Author

Found a workaround finally

var busWithLogger = CreateMeABus.WithLogging(_loggerFactory);
busWithLogger.MessageSubjectProvider = new ConstantSubjectProvider("Amazon SES Email Event Notification");

public class ConstantSubjectProvider : IMessageSubjectProvider
{
private readonly string _subject;

        public ConstantSubjectProvider(string subject)
        {
            _subject = subject;
        }

        public string GetSubjectForType(Type messageType)
        {
            return _subject;
        }
    }

@punyap181
Copy link
Author

Please add description to this property "MessageSubjectProvider" in the documentation

@martincostello martincostello added this to the v7.0.0 milestone Nov 9, 2021
@martincostello
Copy link
Member

Thanks for the report - we'll incorporate this into our documentation efforts for when we release version 7.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants