public void TryReceiveById(string messageId)
{
try
{
//Use of `None` here is intentional since ReceiveById works properly with this mode
//for both transactional and non-transactional queues
queue.ReceiveById(messageId, MessageQueueTransactionType.None);
}
catch (InvalidOperationException)
{
// thrown when message not found
}
}