diff --git a/docs/en/Distributed-Event-Bus.md b/docs/en/Distributed-Event-Bus.md index 1e8549d8f0..d542ef5325 100644 --- a/docs/en/Distributed-Event-Bus.md +++ b/docs/en/Distributed-Event-Bus.md @@ -302,55 +302,4 @@ namespace AbpDemo } ```` -This example uses the `AutoMap` attribute of the AutoMapper to configure the mapping. You could create a profile class instead. Please refer to the AutoMapper document for more options. - -## Exception Handling - -ABP provides exception handling and retries when an exception occurs, it will move to the dead letter queue after the retry fails. - -Enable exception handling: - -```csharp -public override void PreConfigureServices(ServiceConfigurationContext context) -{ - PreConfigure(options => - { - options.EnabledErrorHandle = true; - options.UseRetryStrategy(); - }); -} -``` - -* `EnabledErrorHandle` is used to enable exception handing. -* `UseRetryStrategy` is used to enable retry. - -When an exception occurs, it will retry every three seconds up to the maximum number of retries(default is 3) and move to dead letter queue, you can change the number of retries, retry interval and dead letter queue name: - -```csharp -PreConfigure(options => -{ - options.DeadLetterName = "dead_queue"; - options.UseRetryStrategy(retryStrategyOptions => - { - retryStrategyOptions.IntervalMillisecond = 0; - retryStrategyOptions.MaxRetryAttempts = 1; - }); -}); -``` - -### Error Handle Selector - -By default all event types will be exception handling, you can use `ErrorHandleSelector` of `AbpEventBusOptions` to change it: - -```csharp -PreConfigure(options => -{ - options.ErrorHandleSelector = type => type == typeof(MyExceptionHandleEventData); -}); -``` - -`options.ErrorHandleSelector` actually a list of type predicate. You can write a lambda expression to define your filter. - -### Customize Exception Handling - -ABP defines the `IEventErrorHandler` interface and implemented by the provider, you can replace it via [dependency injection](Dependency-Injection.md) \ No newline at end of file +This example uses the `AutoMap` attribute of the AutoMapper to configure the mapping. You could create a profile class instead. Please refer to the AutoMapper document for more options. \ No newline at end of file diff --git a/docs/en/Local-Event-Bus.md b/docs/en/Local-Event-Bus.md index 82c839a996..879d3c7233 100644 --- a/docs/en/Local-Event-Bus.md +++ b/docs/en/Local-Event-Bus.md @@ -158,52 +158,6 @@ If you perform **database operations** and use the [repositories](Repositories.m > The handler class must be registered to the dependency injection (DI). The sample above uses the `ITransientDependency` to accomplish it. See the [DI document](Dependency-Injection.md) for more options. -## Exception Handling - -ABP provides exception handling and retries when an exception occurs. - -Enable exception handling: - -```csharp -public override void PreConfigureServices(ServiceConfigurationContext context) -{ - PreConfigure(options => - { - options.UseRetryStrategy(); - }); -} -``` - -When an exception occurs, it will retry every three seconds up to the maximum number of retries(default is 3) and throw the original exception, you can change the number of retries and the retry interval: - -```csharp -PreConfigure(options => -{ - options.UseRetryStrategy(retryStrategyOptions => - { - retryStrategyOptions.IntervalMillisecond = 0; - retryStrategyOptions.MaxRetryAttempts = 1; - }); -}); -``` - -### Error Handle Selector - -By default all event types will be exception handling, you can use `ErrorHandleSelector` of `AbpEventBusOptions` to change it: - -```csharp -PreConfigure(options => -{ - options.ErrorHandleSelector = type => type == typeof(MyExceptionHandleEventData); -}); -``` - -`options.ErrorHandleSelector` actually a list of type predicate. You can write a lambda expression to define your filter. - -### Customize Exception Handling - -ABP defines the `IEventErrorHandler` interface and implemented by `LocalEventErrorHandler`, you can replace it via [dependency injection](Dependency-Injection.md) - ### Transaction & Exception Behavior When an event published, subscribed event handlers are immediately executed. So; diff --git a/docs/zh-Hans/Distributed-Event-Bus.md b/docs/zh-Hans/Distributed-Event-Bus.md index bd086c3d83..720560b4be 100644 --- a/docs/zh-Hans/Distributed-Event-Bus.md +++ b/docs/zh-Hans/Distributed-Event-Bus.md @@ -299,55 +299,4 @@ namespace AbpDemo } ```` -此示例使用AutoMapper的 `AutoMap` 属性配置的映射. 你可以创建一个配置文件类代替. 请参阅AutoMapper文档了解更多选项. - -## 异常处理 - -ABP提供了异常处理, 它会进行重试并且重试失败后移动到死信队列. - -启用异常处理: - -```csharp -public override void PreConfigureServices(ServiceConfigurationContext context) -{ - PreConfigure(options => - { - options.EnabledErrorHandle = true; - options.UseRetryStrategy(); - }); -} -``` - -* `EnabledErrorHandle` 用于启用异常处理. -* `UseRetryStrategy` 用于启用重试. - -当一个异常抛出,它会每3秒重试一次直到最大重试次数(默认是3)并且移动到错误队列, 你可以更改重试次数,重试间隔和死信队列名称: - -```csharp -PreConfigure(options => -{ - options.DeadLetterName = "dead_queue"; - options.UseRetryStrategy(retryStrategyOptions => - { - retryStrategyOptions.IntervalMillisecond = 0; - retryStrategyOptions.MaxRetryAttempts = 1; - }); -}); -``` - -### 错误处理选择器 - -默认所有的事件类型都会被处理, 你可以使用 `AbpEventBusOptions` 的 `ErrorHandleSelector` 来更改它: - -```csharp -PreConfigure(options => -{ - options.ErrorHandleSelector = type => type == typeof(MyExceptionHandleEventData); -}); -``` - -`options.ErrorHandleSelector` 实际上是一个类型类型谓词列表. 你可以编写lambda来定义你的过滤. - -### 自定义异常处理 - -ABP定义了 `IEventErrorHandler` 接口并且由提供程序实现, 你可以通过[依赖注入](Dependency-Injection.md)替换它. \ No newline at end of file +此示例使用AutoMapper的 `AutoMap` 属性配置的映射. 你可以创建一个配置文件类代替. 请参阅AutoMapper文档了解更多选项. \ No newline at end of file diff --git a/docs/zh-Hans/Local-Event-Bus.md b/docs/zh-Hans/Local-Event-Bus.md index 3a2944d32b..9d7eb4b766 100644 --- a/docs/zh-Hans/Local-Event-Bus.md +++ b/docs/zh-Hans/Local-Event-Bus.md @@ -158,52 +158,6 @@ namespace AbpDemo 如果您执行**数据库操作**并在事件处理程序中使用[仓储](Repositories.md),那么您可能需要创建一个[工作单元](Unit-Of-Work.md),因为一些存储库方法需要在**活动的工作单元**中工作. 确保处理方法设置为 `virtual`,并为该方法添加一个 `[UnitOfWork]` attribute. 或者手动使用 `IUnitOfWorkManager` 创建一个工作单元范围. -## 异常处理 - -ABP提供了异常处理, 当异常发现时它会进行重试. - -启用异常处理: - -```csharp -public override void PreConfigureServices(ServiceConfigurationContext context) -{ - PreConfigure(options => - { - options.UseRetryStrategy(); - }); -} -``` - -当一个异常抛出,它会每3秒重试一次直到最大重试次数(默认是3)并且移动抛出原始异常, 你可以更改重试次数和重试间隔和: - -```csharp -PreConfigure(options => -{ - options.UseRetryStrategy(retryStrategyOptions => - { - retryStrategyOptions.IntervalMillisecond = 0; - retryStrategyOptions.MaxRetryAttempts = 1; - }); -}); -``` - -### 错误处理选择器 - -默认所有的事件类型都会被处理, 你可以使用 `AbpEventBusOptions` 的 `ErrorHandleSelector` 来更改它: - -```csharp -PreConfigure(options => -{ - options.ErrorHandleSelector = type => type == typeof(MyExceptionHandleEventData); -}); -``` - -`options.ErrorHandleSelector` 实际上是一个类型类型谓词列表. 你可以编写lambda来定义你的过滤. - -### 自定义异常处理 - -ABP定义了 `IEventErrorHandler` 接口并且由 `LocalEventErrorHandler` 实现, 你可以通过[依赖注入](Dependency-Injection.md)替换它. - ### 事务和异常行为 当一个事件发布,订阅的事件处理程序将立即执行.所以;