Browse files

Merge pull request #463 from mattiasw2/master

Return null if message queue empty, not Queue empty exception
  • Loading branch information...
2 parents 75b9203 + eaaf484 commit 0555d71a944c5629c0b22a917d596184f33a1cfa @mythz mythz committed Feb 13, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/ServiceStack.Common/Messaging/MessageQueueClientFactory.cs
View
10 src/ServiceStack.Common/Messaging/MessageQueueClientFactory.cs
@@ -46,6 +46,11 @@ public void PublishMessage(string queueName, byte[] messageBytes)
InvokeMessageReceived(new EventArgs());
}
+ /// <summary>
+ /// Returns the next message from queueName or null if no message
+ /// </summary>
+ /// <param name="queueName"></param>
+ /// <returns></returns>
public byte[] GetMessageAsync(string queueName)
{
lock (syncLock)
@@ -56,6 +61,11 @@ public byte[] GetMessageAsync(string queueName)
return null;
}
+ if (bytesQueue.Count == 0)
+ {
+ return null;
+ }
+
var messageBytes = bytesQueue.Dequeue();
return messageBytes;
}

0 comments on commit 0555d71

Please sign in to comment.