mirror of https://github.com/abpframework/abp.git
6 changed files with 139 additions and 1 deletions
@ -0,0 +1,65 @@ |
|||||
|
# Distributed Event Bus Rebus Integration |
||||
|
|
||||
|
> This document explains **how to configure the [Rebus](http://mookid.dk/category/rebus/)** as the distributed event bus provider. See the [distributed event bus document](Distributed-Event-Bus.md) to learn how to use the distributed event bus system |
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
Use the ABP CLI to add [Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus) NuGet package to your project: |
||||
|
|
||||
|
* Install the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI) if you haven't installed before. |
||||
|
* Open a command line (terminal) in the directory of the `.csproj` file you want to add the `Volo.Abp.EventBus.Rebus` package. |
||||
|
* Run `abp add-package Volo.Abp.EventBus.Rebusv` command. |
||||
|
|
||||
|
If you want to do it manually, install the [Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus) NuGet package to your project and add `[DependsOn(typeof(AbpEventBusRebusModule))]` to the [ABP module](Module-Development-Basics.md) class inside your project. |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
You can configure using the standard [configuration system](Configuration.md), like using the [options](Options.md) classes. |
||||
|
|
||||
|
### The Options Classes |
||||
|
|
||||
|
`AbpRebusEventBusOptions` classe can be used to configure the event bus options for the Rebus. |
||||
|
|
||||
|
You can configure this options inside the `PreConfigureServices` of your [module](Module-Development-Basics.md). |
||||
|
|
||||
|
**Example: Minimize configuration** |
||||
|
|
||||
|
```csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
Rebus has many options, you can use the `Configurer` property of `AbpRebusEventBusOptions` class to configure. |
||||
|
|
||||
|
Default events are **stored in memory**. See the [rebus document](https://github.com/rebus-org/Rebus/wiki/Transport) for more details. |
||||
|
|
||||
|
**Example: Configure the store** |
||||
|
|
||||
|
````csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
options.Configurer = rebusConfigurer => |
||||
|
{ |
||||
|
rebusConfigurer.Transport(t => t.UseMsmq("eventbus")); |
||||
|
rebusConfigurer.Subscriptions(s => s.UseJsonFile(@"subscriptions.json")); |
||||
|
}; |
||||
|
}); |
||||
|
```` |
||||
|
|
||||
|
You can use the `Publish` properpty of `AbpRebusEventBusOptions` class to change the publishing method |
||||
|
|
||||
|
**Example: Configure the event publishing** |
||||
|
|
||||
|
````csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
options.Publish = async (bus, type, data) => |
||||
|
{ |
||||
|
await bus.Publish(data); |
||||
|
}; |
||||
|
}); |
||||
|
```` |
||||
@ -0,0 +1,63 @@ |
|||||
|
# 分布式事件总线Rebus集成 |
||||
|
|
||||
|
> 本文解释了**如何配置[Rebus](http://mookid.dk/category/rebus/)**做为分布式总线提供程序. 参阅[分布式事件总线文档](Distributed-Event-Bus.md)了解如何使用分布式事件总线系统. |
||||
|
|
||||
|
## 安装 |
||||
|
|
||||
|
使用ABP CLI添加[Volo.Abp.EventBus.Rebus[Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus)NuGet包到你的项目: |
||||
|
|
||||
|
* 安装[ABP CLI](https://docs.abp.io/en/abp/latest/CLI),如果你还没有安装. |
||||
|
* 在你想要安装 `Volo.Abp.EventBus.Rebus` 包的 `.csproj` 文件目录打开命令行(终端). |
||||
|
* 运行 `abp add-package Volo.Abp.EventBus.Rebus` 命令. |
||||
|
|
||||
|
如果你想要手动安装,安装[Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus) NuGet 包到你的项目然后添加 `[DependsOn(typeof(AbpEventBusRebusModule))]` 到你的项目[模块](Module-Development-Basics.md)类. |
||||
|
|
||||
|
## 配置 |
||||
|
|
||||
|
可以使用配置使用标准的[配置系统](Configuration.md),如[选项](Options.md)类. |
||||
|
|
||||
|
`AbpRebusEventBusOptions` 类用于配置事件总线选项. |
||||
|
|
||||
|
你可以在你的[模块](Module-Development-Basics.md)的 `PreConfigureServices` 方法配置选项. |
||||
|
|
||||
|
**示例: 最小化配置** |
||||
|
|
||||
|
```csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
Rebus 有很多选项,你可以使用 `AbpRebusEventBusOptions` 的 `Configurer` 属性来配置. |
||||
|
|
||||
|
默认事件**存储在内存中**. 参阅[rebus文档](https://github.com/rebus-org/Rebus/wiki/Transport)了解更多信息. |
||||
|
|
||||
|
**示例: 配置存储** |
||||
|
|
||||
|
````csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
options.Configurer = rebusConfigurer => |
||||
|
{ |
||||
|
rebusConfigurer.Transport(t => t.UseMsmq("eventbus")); |
||||
|
rebusConfigurer.Subscriptions(s => s.UseJsonFile(@"subscriptions.json")); |
||||
|
}; |
||||
|
}); |
||||
|
```` |
||||
|
|
||||
|
你可以使用 `AbpRebusEventBusOptions` 的 `Publish` 属性来更改发布方法. |
||||
|
|
||||
|
**示例: 配置事件发布** |
||||
|
|
||||
|
````csharp |
||||
|
PreConfigure<AbpRebusEventBusOptions>(options => |
||||
|
{ |
||||
|
options.InputQueueName = "eventbus"; |
||||
|
options.Publish = async (bus, type, data) => |
||||
|
{ |
||||
|
await bus.Publish(data); |
||||
|
}; |
||||
|
}); |
||||
|
```` |
||||
Loading…
Reference in new issue