-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
I am using azure storage queues to push messages then i ma running an aspnet core worker app to process the queue. After successfully getting a message and logging it to the db, i can delete the message. The app then hangs at that line and never returns. This like is the main issue:
await _queueViews.DeleteMessageAsync(msgClick);
here is the rest of the code
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
_queueClicks = queueClient.GetQueueReference(ClicksQueue);
_queueViews = queueClient.GetQueueReference(ItemViewsQueue);
_queueClicks.CreateIfNotExistsAsync();
_queueViews.CreateIfNotExistsAsync();
....
....
..
var msgClick = await _queueClicks.GetMessageAsync();
if (!(msgClick is null))
{
var content = JsonConvert.DeserializeObject(msgClick.AsString);
if (content != null && content.ItemClickLog != null)
{
if (!await _context.ShopItemClickLogs.AnyAsync(a => a.Id == content.ItemClickLog.Id))
{
await _context.ShopItemClickLogs.AddAsync(content.ItemClickLog);
await _context.SaveChangesAsync(stoppingToken).ConfigureAwait(false);
}
try
{
await _queueViews.DeleteMessageAsync(msgClick);
}
catch (AggregateException axp)
{
_logger.LogError(axp.Message);
}
}
}