This document describes how to consume messages from and send messages to non-NServiceBus endpoints via Amazon SQS in integration scenarios.
Access to the native Amazon SQS message details
It can sometimes be useful to access the native Amazon SQS message from behaviors and handlers. When a message is received, the transport adds the native message Amazon.
to the message processing context. Use the code below to access the message details from a pipeline behavior:
class AccessToAmazonSqsNativeMessage : Behavior<IIncomingContext>
{
public override Task Invoke(IIncomingContext context, Func<Task> next)
{
// get the native Amazon SQS message
var message = context.Extensions.Get<Message>();
//do something useful
return next();
}
}