1

I am looking to migrate some work that uses Microsoft.ServiceBus over to Microsoft.Azure.ServiceBus. This is so that we can target .net standard.

The previous code uses ReceiveBatchAsync in order to retrieve multiple messages within a single call.

In the new namespace I can't see a way of doing this.

Is there something new in the design that make this redundant, or is the 1.0.0 release version only partially complete?

The best practice guidelines seem to refer to the Microsoft.ServiceBus version.

Mark W
  • 705
  • 1
  • 9
  • 20

2 Answers2

3

Batch method is now also called just ReceiveAsync, use the overload with maxMessageCount parameter.

/// <summary>
/// Receives a maximum of <paramref name="maxMessageCount"/> messages from 
/// the entity defined by IReceiverClient.Path using ReceiveMode mode.
/// </summary>
/// <param name="maxMessageCount">The maximum number of messages that will 
/// be received.</param>
/// <returns>List of messages received. Returns null if no message is found.</returns>    
Task<IList<Message>> ReceiveAsync(int maxMessageCount);
Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • 1
    Have you seen any degradation in performance between the two versions. My (very preliminary) tests look like its ALOT slower. – Mark W Sep 07 '17 at 09:57
1

In version 2.0 of Microsoft.Azure.ServiceBus there is no support for batch receiving messages. The only way is to use message pump, that in Microsoft.ServiceBus.Messaging was called OnMessage, and in .Net Standard nuget package is called RegisterMessageHandler.

There is a great comparsion of those two clients by Sean Feldman here: Microsoft.ServiceBus.Messaging vs Microsoft.Azure.ServiceBus

Microsoft.Azure.ServiceBus is still being developed and as for now (March 2018) it still lacks entity creation support, so you cannot for example create or update topic subscription.

Mik
  • 3,998
  • 2
  • 26
  • 16