Browse Source

docs: 添加分布式事件文档

pull/95/head
王军 3 years ago
parent
commit
1b93341884
  1. 1
      docs/content/index.md
  2. 46
      docs/content/user-guide/zh/infrastructure/cap.md
  3. 22
      docs/content/user-guide/zh/infrastructure/config.md
  4. 1
      docs/mkdocs.yml

1
docs/content/index.md

@ -31,6 +31,7 @@ Title: Abp Vnext Pro
- [x] Setting 管理
- [x] 多租户
- [x] 文件管理
- [x] 多语言管理
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/4.4/4.4login.png)
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/01.png)

46
docs/content/user-guide/zh/infrastructure/cap.md

@ -0,0 +1,46 @@
## dotnetcore.cap
分布式事件总线系统允许发布和订阅跨应用/服务边界传输的事件. 你可以使用分布式事件总线在微服务或应用程序之间异步发送和接收消息.
### 安装
- 添加以下 NuGet 包到你的项目
- Lion.AbpPro.CAP
- Lion.AbpPro.CAP.EntityFrameworkCore
- DotNetCore.CAP.MySql (如果是其它数据库,请安装对应类型)
- DotNetCore.CAP.RabbitMQ (如果是其它中间件,请安装对应类型)
- 添加 [DependsOn(typeof(LionAbpProCapEntityFrameworkCoreModule))] 到你的项目模块类.
## 配置
Mysql,和 RabbitMq 为例
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.AddAbpCap(capOptions =>
{
// 指定数据数据库连接字符串
capOptions.SetCapDbConnectionString(configuration["ConnectionStrings:Default"]);
capOptions.UseEntityFramework<AbpProDbContext>();
// 使用rabbitmq,配置host,username,password
capOptions.UseRabbitMQ(option =>
{
option.HostName = configuration.GetValue<string>("Cap:RabbitMq:HostName");
option.UserName = configuration.GetValue<string>("Cap:RabbitMq:UserName");
option.Password = configuration.GetValue<string>("Cap:RabbitMq:Password");
});
var hostingEnvironment = context.Services.GetHostingEnvironment();
bool auth = !hostingEnvironment.IsDevelopment();
// 启用面板
capOptions.UseDashboard(options =>
{
options.UseAuth = auth;
options.AuthorizationPolicy = LionAbpProCapPermissions.CapManagement.Cap;
});
});
}
```
- 即可使用 Abp vNext 标准写法,发送分布式事件和订阅事件

22
docs/content/user-guide/zh/infrastructure/config.md

@ -51,7 +51,9 @@
```
### 写入 ES
!!! WARNING "先决条件:搭建好 ES 环境"
- Enabled:是否启用
- Url:es 地址
- IndexFormat:es 索引
@ -97,16 +99,17 @@ public class Program
}
```
## 跨域(CORS)
- 允许指定策略
```json
"App": {
// 逗号分隔
"CorsOrigins": "http://*.com,http://localhost:4200"
},
```
- 配置跨域
```csharp
@ -140,6 +143,7 @@ private void ConfigureCors(ServiceConfigurationContext context)
- Issuer:签发主体
- SecurityKey:密钥
- ExpirationTime:过期时间(单位小时)
```json
"Jwt": {
"Audience": "Lion.AbpPro",
@ -148,19 +152,3 @@ private void ConfigureCors(ServiceConfigurationContext context)
"ExpirationTime": 30
}
```
## CAP
!!! WARNING "如果要切换其他中间件请参考 [dotnetcore.cap](https://cap.dotnetcore.xyz/)"
- Enabled: 是否启用
- RabbitMq:Mq配置
```json
"Cap": {
"Enabled": "true",
"RabbitMq": {
"HostName": "localhost",
"UserName": "admin",
"Password": "admin"
}
}
```

1
docs/mkdocs.yml

@ -78,6 +78,7 @@ nav:
- 配置: user-guide/zh/infrastructure/config.md
- 前端: user-guide/zh/infrastructure/frontend.md
- FreeSql: user-guide/zh/infrastructure/freesql.md
- 分布式事件: user-guide/zh/infrastructure/cap.md
- 应用模块:
- 基础模块: user-guide/zh/modules/basic.md
- 设置(Setting): user-guide/zh/modules/setting.md

Loading…
Cancel
Save