I have a netstandard2.1
application and I am using nuget package "Microsoft.Azure.ServiceBus" Version="4.1.1"
.
I am creating a azure service bus SubscriptionClient
and trying to use PeekBatch
and ReceiveBatch
, but I am getting below erros, What is missing here?
'SubscriptionClient' does not contain a definition for 'PeekBatch' and no accessible extension method 'PeekBatch' accepting a first argument of type 'SubscriptionClient' could be found
'SubscriptionClient' does not contain a definition for 'ReceiveBatch' and no accessible extension method 'PeekBatch' accepting a first argument of type 'SubscriptionClient' could be found
_subscriptionClient = new SubscriptionClient(connectionString, topicName, subscriptionName, ReceiveMode.ReceiveAndDelete);
_subscriptionClient.PrefetchCount = 16;
while (_subscriptionClient.PeekBatch(16).Any())
{
var pendingMessages = _subscriptionClient.ReceiveBatch(16, TimeSpan.FromSeconds(1))?.ToList();
if (pendingMessages != null)
{
foreach (var message in pendingMessages)
{
// do processing of the message
}
}
}