What is the message count limit that can be published to service bus topic at a time using
TransactionScopeOption as Suppress.i am publishing message in batches
I tried publishing 300 messages in a batch..they got published
but- with 400 message count they are not getting published
the size of both the batches are less than 256 kb.
using .net core 3.1
is there a limit on number of messages along with size as well?
var topicClient= new TopicClient(this.servicebusConnectionString, name);
using (var scope = new TransactionScope(TransactionScopeOption.Suppress, TransactionScopeAsyncFlowOption.Enabled))
{
foreach (var batch in GetBatches(messageList, BatchSize))
{
await this.topicClient.SendAsync(batch.ToList()).ConfigureAwait(false);
}
scope.Complete();
}
for creating batches I am using below function:
public static IEnumerable<IEnumerable<Message>> GetBatches(IList<Message> source, long bucketSize)
{
List<Message> bucket = null;
long size = 0;
foreach (var item in source)
{
if (bucket == null)
{
bucket = new List<Message>();
}
size += item.Size;
if (size <= bucketSize * ConvertToBytes)
{
bucket.Add(item);
continue;
}
yield return bucket;
bucket = new List<Message> { item };
size = item.Size;
}
if (bucket?.Count > 0 && size <= bucketSize * ConvertToBytes)
{
yield return bucket;
}
}