Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
yang-xiaodong committed Apr 18, 2024
1 parent 36dfc31 commit 8dee0c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
7 changes: 2 additions & 5 deletions docs/content/user-guide/en/cap/configuration.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
# Configuration

By default, you can specify configuration when you register CAP services into the IoC container for ASP.NET Core project.
By default, you can specify configuration when you register CAP services into the DI container for ASP.NET Core project.

```c#
services.AddCap(config=>
{
// config.XXX
});
```

`services` is `IServiceCollection` interface, which can be found in the `Microsoft.Extensions.DependencyInjection` package.

If you don't want to use Microsoft's IoC container, you can take a look at ASP.NET Core documentation [here](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2#default-service-container-replacement) to learn how to replace the default container implementation.

## What is minimum configuration required for CAP

you have to configure at least a transport and a storage. If you want to get started quickly you can use the following configuration:

```C#
services.AddCap(capOptions =>
{
capOptions.UseInMemoryQueue();
capOptions.UseInMemoryQueue(); //Required Savorboard.CAP.InMemoryMessageQueue nuget package.
capOptions.UseInmemoryStorage();
});
```
Expand Down
11 changes: 4 additions & 7 deletions docs/content/user-guide/zh/cap/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 配置

默认情况下,你在向IoC容器中注册CAP服务的时候指定配置
默认情况下,你在向DI容器中注册CAP服务的时候指定此配置

```c#
services.AddCap(config=> {
Expand All @@ -10,21 +10,19 @@ services.AddCap(config=> {

其中 `services` 代表的是 `IServiceCollection` 接口对象,它位于 `Microsoft.Extensions.DependencyInjection` 下面。

如果你不想使用微软的IoC容器,那么你可以查看 [ASP.NET Core 这里的文档](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2#default-service-container-replacement) 来了解如何替换默认的容器实现。

## 什么是最低配置?

最简单的回答就是,至少你要配置一个消息队列和一个事件存储,如果你想快速开始你可以使用下面的配置:
最简单的回答就是,至少你要配置一个传输器和一个存储,如果你想快速开始你可以使用下面的配置:

```C#
services.AddCap(config =>
{
config.UseInMemoryMessageQueue();
config.UseInMemoryMessageQueue(); //需要引用 Savorboard.CAP.InMemoryMessageQueue 包
config.UseInMemoryStorage();
});
```

有关具体的消息队列的配置和存储的配置,你可以查看 Transports 章节和 Persistent 章节中具体组件提供的配置项。
有关具体的传输器配置和存储配置,你可以查看 Transports 章节和 Persistent 章节中具体组件提供的配置项。

## CAP 中的自定义配置

Expand All @@ -43,7 +41,6 @@ services.AddCap(config =>
在 NATS 中映射到 [Queue Group Name](https://docs.nats.io/nats-concepts/queue).
在 Redis Streams 中映射到 [Consumer Group](https://redis.io/topics/streams-intro#creating-a-consumer-group).


#### GroupNamePrefix

默认值:Null
Expand Down
4 changes: 1 addition & 3 deletions docs/content/user-guide/zh/cap/filter.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# 过滤器

在 5.1.0 版本中,我们支持了在订阅者中添加过滤器。在过去,我们通过对第三方 AOP 组件提供支持来做到这一点,例如我们写了一篇[博客](https://www.cnblogs.com/savorboard/p/cap-castle.html) 来描述如何在 CAP 5.0 版本中使用 Castle 来对订阅方法进行拦截,但了这种方式存在一些缺点,例如无法方便的在代理类中进行构造函数注入以及方法需要设定为 virtual 另外还有拦截器生命周期控制等问题。

所以我们引入了对订阅者过滤器的支持,以使在某些场景(如事务处理,日志记录等)中变得容易。
从 5.1.0 版本后,我们引入了对订阅者过滤器的支持,以使在某些场景(如事务处理,日志记录等)中变得容易。

## 自定义过滤器

Expand Down

0 comments on commit 8dee0c1

Please sign in to comment.