Hi Tim, the first bullet point I think is the thing I really want to do. As per the documentation you linked, “a MessageTypeFullName
message attribute must be present.” It is not present and I’d like to do whatever transformation is required upstream of the deserialization including adding the attribute.
I presently have mutators for IMutateIncomingMessages
and IMutateIncomingTransportMessages
as well as a behavior for IIncomingPhysicalMessageContext
. These implementations take no action other than to print to the console. When I send a message to the bus via my application all three print statements are seen indicating each component is invoked.
When I send a message to the queue with the AWS CLI (imitating an SNS notification) the processing throws an exception. If I do not include any message attributes I get this:
[2022/09/09 08:48:38 Warning] [NServiceBus.Transport.SQS.MessagePump] Treating message with a664d7ae-594f-45f1-9e0a-de870bd2dcb5 as a poison message. Moving to error queue.
System.ArgumentNullException: Value cannot be null. (Parameter 's')
at System.Convert.FromBase64String(String s)
at NServiceBus.Transport.SQS.Extensions.MessageExtensions.RetrieveBody(TransportMessage transportMessage, IAmazonS3 s3Client, TransportConfiguration transportConfiguration, CancellationToken cancellationToken) in /_/src/NServiceBus.Transport.SQS/Extensions/MessageExtensions.cs:line 21
at NServiceBus.Transport.SQS.InputQueuePump.ProcessMessage(Message receivedMessage, SemaphoreSlim processingSemaphoreSlim, CancellationToken token) in /_/src/NServiceBus.Transport.SQS/InputQueuePump.cs:line 202
If I include MessageTypeFullName
(that does not yet resolve to an existing class name), I get this:
[2022/09/09 08:37:29 Warning] [NServiceBus.Transport.SQS.MessagePump] Treating message with bad2ae2d-e442-44a8-987e-e5477aee6a65 as a poison message. Moving to error queue.
System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
at System.Convert.FromBase64_ComputeResultLength(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at NServiceBus.Transport.SQS.Extensions.MessageExtensions.RetrieveBody(TransportMessage transportMessage, IAmazonS3 s3Client, TransportConfiguration transportConfiguration, CancellationToken cancellationToken) in /_/src/NServiceBus.Transport.SQS/Extensions/MessageExtensions.cs:line 21
at NServiceBus.Transport.SQS.InputQueuePump.ProcessMessage(Message receivedMessage, SemaphoreSlim processingSemaphoreSlim, CancellationToken token) in /_/src/NServiceBus.Transport.SQS/InputQueuePump.cs:line 202
So both paths seem to rely on some part of the incoming message being base 64 encoded. I’d like to take any arbitrary incoming message and transform/amend it for NServiceBus to deserialize into an object instance (although my specific current need is for SNS notifications).
Do you have any further direction to suggest? Thank you.
/Daryl