An enterprise inventory application uses Azure Service Bus to coordinate message routing. A developer is implementing a transaction-based message processing flow in C# using the Azure.Messaging.ServiceBus SDK. The application must receive a message from an input queue named orders-input, send a related message to an output queue named orders-output (within the same namespace), and then complete the original message. The entire sequence must occur inside a single atomic transaction.
The developer writes the following implementation:
csharp
using System.Transactions;
using Azure.Messaging.ServiceBus;
// ... client initialization ...
var options = new ServiceBusReceiverOptions
{
ReceiveMode = // [Configuration here]
};
ServiceBusReceiver receiver = client.CreateReceiver("orders-input", options);
ServiceBusSender sender = client.CreateSender("orders-output");
using (var ts = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
ServiceBusReceivedMessage message = await receiver.ReceiveMessageAsync();
// processing logic...
var response = new ServiceBusMessage("Order Processed");
await sender.SendMessageAsync(response);
await receiver.CompleteMessageAsync(message);
ts.Complete();
}
Which of the following configurations is required to ensure that if the send or complete operation fails, the transaction rolls back and the original message remains in the input queue?
- AConfigure the `ReceiveMode` to `ServiceBusReceiveMode.ReceiveAndDelete`.
- BConfigure the `ReceiveMode` to `ServiceBusReceiveMode.PeekLock` and connect using a Shared Access Signature (SAS) token restricted to the Manage permission scope.
- Configure the `ReceiveMode` to `ServiceBusReceiveMode.PeekLock`.Answer
- DConfigure the `ReceiveMode` to `ServiceBusReceiveMode.PeekLock` and retrieve the connection string from Azure Key Vault using a managed identity that lacks Secret Get access policy permissions.