2

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.

Greg
  • 25,317
  • 6
  • 53
  • 62
  • Hello @Greg based on the [MS DOC](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas) for a single transaction the number of messages is 100 for both send() & sendasync() as shown in the below [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/GdoHI.png – AjayKumarGhose Nov 15 '21 at 13:02
  • @AjayKumarGhose-MT what's a single transaction? I know you can send a batch messages and also create a session, but I believe what I'm doing here is a 4 transaction, isn't it? Also I dont have a 'Can't send more than 100 messages in a single transaction' exception – Greg Nov 15 '21 at 14:23

1 Answers1

2

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

Petr Hruzek
  • 630
  • 1
  • 5
  • 12