Is it possible to query an azure queue to find whether an item is somewhere in a specified queue (based on some key property)?
Azure queue: find whether item is in queue
Asked Answered
The Service Bus Queues have a duplicate detection option, which may solve the problem? –
Subdeacon
Azure Queues are meant for async message passing, not searching. You should use an Azure Table or SQL Azure DB if you want indexing support.
Azure Queues will only let you peek the next message without dequeuing.
Looking at the REST API, all message operations work off the front of the queue (or require a popreceipt, which means you retrieved a message from the front of the queue): msdn.microsoft.com/en-us/library/windowsazure/dd135717.aspx. –
Jeweljeweler
From the MSDN link you shared - it looks like you can PEEK a maximum of 32 queue messages without dequeuing them. –
Mudpack
Please check Microsoft Azure Storage. This is a great tool for managing the contents. Upload, download and manage blobs, files, queues, tables and Cosmos DB entities.
Of course it is very bad approach to perform search operations in message queue but you can try something like this:
var qm = queue.GetMessages(20);
if (!qm.Any(x => x.AsString.Contains(key_property)))
{
queue.AddMessage(message);
}
you can read only 32 messages maximum and this is a search on code level –
Catwalk
© 2022 - 2024 — McMap. All rights reserved.