'Azure Service Bus send message every other time

I've a c# dotnet webjob and a simple desktop app. Sending a message apperaes to work only every other time.

            serviceBusClient = new QueueClient(_config["ServiceBusConnectionString"], "queuename", ReceiveMode.ReceiveAndDelete);
            await serviceBusClient.SendMigrationMessageAsync("1", label);
            await serviceBusClient.SendMigrationMessageAsync("2", label);
            await serviceBusClient.SendMigrationMessageAsync("3", label);
            await serviceBusClient.SendMigrationMessageAsync("4", label);

SendMigrationMessageAsync is an extension:

    public static async Task SendMigrationMessageAsync(this IQueueClient client, string messageText, string label)
    {
        Message message = new Message(Encoding.UTF8.GetBytes(messageText));
        message.Label = label;
        await client.SendAsync(message);
    }

In the destkop app I registered to receive the message and also registered a message exception handler (which is not call at all). In this scenario I can only receive message "2" and "4". When I stopped execution after the first message had been sent, the message never showed up on the Azure service.

Thanks in advance

EDITED: I found out that arter creating brand new Azure Service Bus Namespace, all is working fine. I had basic pricing tier and even after upgrading to standard I was able to only send every other message. Creating new service sorted this out.

Is there any limitation or throtling? I haven't sent many messages at all, something around 300 daily.



Solution 1:[1]

You most probably had two processes with the same subscription id, so they are "stealing" messages from each other. Let's say there are two console apps, the first one sending messages and the second one receiving.

With both having same subscription id it looks like this:

And with the unique subscription for each process everything is ok:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1