You are developing a C# console application that processes telemetry alerts from wind turbines using an Azure Service Bus queue. The application uses the `Azure.Messaging.ServiceBus` SDK.
You write the following code:
csharp
using System;
using System.Threading.Tasks;
using Azure.Messaging.ServiceBus;
// ... connection details omitted for brevity ...
var client = new ServiceBusClient(connectionString);
var options = new ServiceBusProcessorOptions
{
ReceiveMode = ServiceBusReceiveMode.PeekLock,
AutoCompleteMessages = false
};
ServiceBusProcessor processor = client.CreateProcessor(queueName, options);
processor.ProcessMessageAsync += async args =>
{
try
{
await ProcessAlertAsync(args.Message);
// Line X
}
catch (Exception)
{
// Line Y
}
};
You must ensure that:
1. Messages are not lost if the application crashes during processing.
2. Messages that fail due to transient errors are returned to the queue to be retried.
3. Successfully processed messages are removed from the queue immediately.
Which two code segments should you use to replace Line X and Line Y? (Select two.)
- At Line X: `await args.CompleteMessageAsync(args.Message);`Cevap
- At Line Y: `await args.AbandonMessageAsync(args.Message);`Cevap
- CAt Line X: `await args.Message.CompleteAsync();`
- DAt Line Y: `await args.DeadLetterMessageAsync(args.Message);`
- EAt Line Y: `args.Message.Abandon();`