McGuireV10
McGuireV10

Reputation: 9946

Azure Service Bus errors

I've been experimenting with the latest Azure Service Bus SDK. Using very low-volume topic messages (posted by manually-executed Azure Function HTTP triggers from my browser), I'm seeing a pretty high failure rate in the Azure dashboard -- something like one out of every four or five messages fails. However, I don't ever catch any exceptions in the Azure Function code. How is a sending application supposed to detect these failures? For that matter, how do I log the specific failures? I see the spikes in the graph but can't find details. (I'm using an MSDN VS Enterprise freebie subscription.) Sometimes the queued messages and/or failures don't show up in the Azure portal for several minutes. (So far I haven't written a subscriber but I'm guessing the portal is effectively a "subscribe to everything" client of some kind.)

The topic is non-partitioned with a long TTL (the 14-day default). No dupe detection. The code is simple enough (try/catch omitted), newevent is a simple C# class with just a couple of properties and ToString is an override using JsonConvert:

        TopicClient topic = new TopicClient(connection, topic);
        Message msg = new Message(Encoding.UTF8.GetBytes(newevent.ToString()));
        msg.MessageId = newevent.Timestamp;
        await topic.SendAsync(msg);
        await topic.CloseAsync();

Upvotes: 0

Views: 819

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35144

I don't think it's a blocker for low-volume traffic, but you shouldn't new up and close your TopicClient for each message. You can create it once and reuse for subsequent requests.

In the context of Azure Functions, you are better off using output binding feature instead of creating TopicClient yourself, see example in docs. The runtime will manage topic client for you then.

Upvotes: 1

Related Questions