Browse Source

Merge pull request #12811 from gdlcf88/azure-publish-many-with-messageId

Make the Azure bus publishes many from outbox with MessageId
pull/12915/head
liangshiwei 4 years ago
committed by GitHub
parent
commit
a2d0169e9b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs

12
framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs

@ -108,9 +108,17 @@ public class AzureDistributedEventBus : DistributedEventBusBase, ISingletonDepen
foreach (var outgoingEvent in outgoingEventArray)
{
if (!messageBatch.TryAddMessage(new ServiceBusMessage(outgoingEvent.EventData) { Subject = outgoingEvent.EventName }))
var message = new ServiceBusMessage(outgoingEvent.EventData) { Subject = outgoingEvent.EventName };
if (message.MessageId.IsNullOrWhiteSpace())
{
message.MessageId = outgoingEvent.Id.ToString();
}
if (!messageBatch.TryAddMessage(message))
{
throw new AbpException("The message is too large to fit in the batch. Set AbpEventBusBoxesOptions.OutboxWaitingEventMaxCount to reduce the number");
throw new AbpException(
"The message is too large to fit in the batch. Set AbpEventBusBoxesOptions.OutboxWaitingEventMaxCount to reduce the number");
}
}

Loading…
Cancel
Save