I am reading from a deadletter queue on servicebus using the ServiceBusReceiver(which I want to continue using).
However, the receiver.PeekMessagesAsync(550) only fetches a maximum of 250 messages from deadletter queue??? How can I change this? I already have it set to fetch 550 messages so not sure how to do it.
string topic = "myTopic";
string subscriptionAndDeadletterPath = @"mySubscription/$deadletterqueue";
var paginationSize = 1000;
var dlqCount = 0;
var numberOfMessagesToFetchFromDlq = 550;
try
{
await using var client = new ServiceBusClient(connectionString);
var receiver = client.CreateReceiver(topic, subscriptionAndDeadletterPath, new ServiceBusReceiverOptions() { ReceiveMode = ServiceBusReceiveMode.PeekLock, PrefetchCount = paginationSize });
var messagesFromDlq = await receiver.PeekMessagesAsync(numberOfMessagesToFetchFromDlq);
dlqCount = messagesFromDlq.Count();
dlqCount will not exceed 250 for some reason? The int maxMessages parameter doesn't seem to work above this number?
This is how I solved it for now: