Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Azure Service Bus Queue Missing Messages

$
0
0
I have an Azure Service Bus queue that is not receiving all messages sent to it. I have 2 test console apps (C#) one to send messages, the other to receive that show this. None of these missing messages are going into the DLQ and no exceptions are being thrown. Below is the pertinent code from each console app. Send:
    var connectionString = "Endpoint=sb://xxxxxx.servicebus.windows.net/;SharedAccessKeyName=client;SharedAccessKey=xxxxxx=;EntityPath=xxxxxx";
    var client = QueueClient.CreateFromConnectionString(connectionString);
    int nCount = 0;
    try
    {
        while (true)
        {
            string strBody = "Msg number:" + nCount;
            var message = new BrokeredMessage(strBody);
            client.Send(message);
            Console.WriteLine(DateTime.Now.ToString() + " Received Body: " + strBody);
            nCount++;
            Thread.Sleep(10000);
        }
    }
    catch (Exception exception)
    {
        Console.WriteLine(exception.ToString());
    }

Receive:
    var connectionString = "Endpoint=sb://xxxxxx.servicebus.windows.net/;SharedAccessKeyName=server;SharedAccessKey=xxxxxx;EntityPath=xxxxxx";
    var Client = QueueClient.CreateFromConnectionString(connectionString);
    Console.WriteLine("Started At: " + DateTime.Now.ToString());
    ManualResetEvent CompletedEvent = new ManualResetEvent(false);
    OnMessageOptions options = new OnMessageOptions();
    options.AutoComplete = true;
    options.MaxConcurrentCalls = 1;
    Client.OnMessage((message) =>
    {
        try
        {
            Console.WriteLine(string.Format(DateTime.Now.ToString() + " Message Body Received: {0}", message.GetBody<string>()));
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }, options);

I don't think the Receive is the problem as if I close the Receive test app only some messages make it into the queue per the Azure portal.

The included image shows the apps runningTest apps

Test apps

The left console is send, the right receive. Ignore in the Send console where it accidentally says "Received Body", should have said "Sent".
Also, using Service Bus Explorer I also can not see the missing messages making it into the Queue. I tried creating a new queue and though more messages got into this new queue it still is not near 100%. More like 80%.

Viewing all articles
Browse latest Browse all 1916

Trending Articles