From 90c828c83a77ea731c62806852511353f1bb693d Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Tue, 31 May 2022 02:31:58 +0800 Subject: [PATCH 1/3] Make the Azure bus publishes many from outbox with MessageId --- .../Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs index 86500cf434..09faf1151e 100644 --- a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs @@ -108,9 +108,14 @@ 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) { + MessageId = outgoingEvent.Id.ToString(), Subject = outgoingEvent.EventName + }; + + 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"); } } From 218ac6c81330571e080f432b067a329c80289f8b Mon Sep 17 00:00:00 2001 From: Engincan VESKE <43685404+EngincanV@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:36:33 +0300 Subject: [PATCH 2/3] Update Error-Handling.md --- docs/en/UI/Blazor/Error-Handling.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/en/UI/Blazor/Error-Handling.md b/docs/en/UI/Blazor/Error-Handling.md index 6582ee0c8e..18cb958f72 100644 --- a/docs/en/UI/Blazor/Error-Handling.md +++ b/docs/en/UI/Blazor/Error-Handling.md @@ -23,12 +23,12 @@ There are different type of `Exception` classes handled differently by the ABP F `UserFriendlyException` is a special type of exception. You can directly show a error message dialog to the user by throwing such an exception. +{{if UI == "BlazorServer"}} + > For Blazor Server, exceptions must be handled manually. Otherwise it crashes the whole application. Auto Exception Handling is not possible with Blazor Server right now, please follow [this issue](https://github.com/abpframework/abp/issues/8195) to see progress. In meantime, you can use try-catch blocks and call the `HandleErrorAsync` method of ABP to handle errors manually, which shows an error dialog for you. **Example** -{{if UI == "BlazorServer"}} - ````csharp @page "/" @using Volo.Abp @@ -55,6 +55,8 @@ There are different type of `Exception` classes handled differently by the ABP F {{if UI == "Blazor"}} +**Example** + ````csharp @page "/" @using Volo.Abp @@ -97,4 +99,4 @@ Errors (like Validation, Authorization and User Friendly Errors) sent by the ser ## See Also -* [Exception Handling System](../../Exception-Handling.md) \ No newline at end of file +* [Exception Handling System](../../Exception-Handling.md) From 706d05e8889b6d0bb2155b54287c19194264f50e Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Fri, 3 Jun 2022 13:04:48 +0800 Subject: [PATCH 3/3] Set MessageId only if ServiceBusMessage doesn't have one --- .../Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs index 09faf1151e..78e26e7c32 100644 --- a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs @@ -108,9 +108,12 @@ public class AzureDistributedEventBus : DistributedEventBusBase, ISingletonDepen foreach (var outgoingEvent in outgoingEventArray) { - var message = new ServiceBusMessage(outgoingEvent.EventData) { - MessageId = outgoingEvent.Id.ToString(), 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)) {