0
votes

I'm creating a consumer of an Azure Service Bus topic (subscription) that does nothing but store some statistics. The messages sent to the topic contains a rather large body, that is handled by another consumer on a second subscription on the same topic.

Since the statistics consumer can handle a large number of messages in one go, I was wondering if it is possible to receive a lot of messages but leave out the body to improve performance when communicating with Service Bus and to receive even more messages in one go.

I'm currently doing this:

this.messageReceiver = new MessageReceiver(conn, path);
...
await messageReceiver.ReceiveAsync(10, TimeSpan.FromSeconds(5));

It works pretty sweet but it would be nice to be able to receive 100 or more messages, without having to worry about moving large messages over the network.

Before anyone suggests it, I already know that I can ask for a count, etc. on a topic subscription. I still need the Message object since that contains an entry in the UserProperties dictionary that is used to calculate the stats.

1
prefetchcount should be the option you're looking at.Sunny Sharma
The article doesn't say anything about the problem. And I don't think you're right about prefetchcount. It's for telling service bus how many messages to prefetch and not if it should include the body or not.ThomasArdal
Are you looking for ways to receive messages without message body?Gaurav Mantri
AFAIK, it's not possible using the SDK as there's no support for providing server-side filtering/projection criteria.Gaurav Mantri

1 Answers

1
votes

Not possible. You can peek, but that brings the whole payload and headers w/o incrementing the DeliveryCount of the message. You could request it as a broker feature here.