diff --git a/docs/content/user-guide/en/transport/general.md b/docs/content/user-guide/en/transport/general.md index f0c0074..a34071d 100644 --- a/docs/content/user-guide/en/transport/general.md +++ b/docs/content/user-guide/en/transport/general.md @@ -10,6 +10,7 @@ CAP supports several transport methods: * [Kafka](kafka.md) * [Azure Service Bus](azure-service-bus.md) * [Amazon SQS](aws-sqs.md) +* [NATS](nats.md) * [In-Memory Queue](in-memory-queue.md) * [Redis Streams](redis-streams.md) diff --git a/docs/content/user-guide/en/transport/nats.md b/docs/content/user-guide/en/transport/nats.md new file mode 100644 index 0000000..4efcd4f --- /dev/null +++ b/docs/content/user-guide/en/transport/nats.md @@ -0,0 +1,56 @@ +# NATS + +[NATS](https://nats.io/) is a simple, secure and performant communications system for digital systems, services and devices. NATS is part of the Cloud Native Computing Foundation (CNCF). + +## Configuration + +To use NATS transporter, you need to install the following package from NuGet: + +```powershell + +PM> Install-Package DotNetCore.CAP.NATS + +``` + +Then you can add configuration items to the `ConfigureServices` method of `Startup.cs`. + +```csharp + +public void ConfigureServices(IServiceCollection services) +{ + services.AddCap(capOptions => + { + capOptions.UseNATS(natsOptions=>{ + //NATS Options + }); + }); +} + +``` + +#### NATS Options + +NATS configuration parameters provided directly by the CAP: + +NAME | DESCRIPTION | TYPE | DEFAULT +:---|:---|---|:--- +Options | NATS client configuration | Options | Options +Servers | Server url/urls used to connect to the NATs server. | string | NULL +ConnectionPoolSize | number of connections pool | uint | 10 + +#### NATS ConfigurationOptions + +If you need **more** native NATS related configuration options, you can set them in the `Options` option: + +```csharp +services.AddCap(capOptions => +{ + capOptions.UseNATS(natsOptions=> + { + // NATS options. + natsOptions.Options.Url=""; + }); +}); +``` + +`Options` is a NATS.Client ConfigurationOptions , you can find more details through this [link](http://nats-io.github.io/nats.net/class_n_a_t_s_1_1_client_1_1_options.html) diff --git a/docs/content/user-guide/zh/transport/general.md b/docs/content/user-guide/zh/transport/general.md index b402aea..13736ef 100644 --- a/docs/content/user-guide/zh/transport/general.md +++ b/docs/content/user-guide/zh/transport/general.md @@ -10,6 +10,7 @@ CAP 支持以下几种运输方式: * [Kafka](kafka.md) * [Azure Service Bus](azure-service-bus.md) * [Amazon SQS](aws-sqs.md) +* [NATS](nats.md) * [In-Memory Queue](in-memory-queue.md) * [Redis Streams](redis-streams.md) diff --git a/docs/content/user-guide/zh/transport/nats.md b/docs/content/user-guide/zh/transport/nats.md new file mode 100644 index 0000000..3ed0e41 --- /dev/null +++ b/docs/content/user-guide/zh/transport/nats.md @@ -0,0 +1,57 @@ +# NATS + +[NATS](https://nats.io/)是一个简单、安全、高性能的数字系统、服务和设备通信系统。NATS 是 CNCF 的一部分。 + +## 配置 + +要使用NATS 传输器,你需要安装下面的NuGet包: + +```powershell + +PM> Install-Package DotNetCore.CAP.NATS + +``` + +你可以通过在 `Startup.cs` 文件中配置 `ConfigureServices` 来添加配置: + +```csharp + +public void ConfigureServices(IServiceCollection services) +{ + services.AddCap(capOptions => + { + capOptions.UseNATS(natsOptions=>{ + //NATS Options + }); + }); +} + +``` + +#### NATS 配置 + +CAP 直接提供的关于 NATS 的配置参数: + + +NAME | DESCRIPTION | TYPE | DEFAULT +:---|:---|---|:--- +Options | NATS 客户端配置 | Options | Options +Servers | 服务器Urls地址 | string | NULL +ConnectionPoolSize | 连接池数量 | uint | 10 + +#### NATS ConfigurationOptions + +如果你需要 **更多** 原生相关的配置项,可以通过 `Options` 配置项进行设定: + +```csharp +services.AddCap(capOptions => +{ + capOptions.UseNATS(natsOptions=> + { + // NATS options. + natsOptions.Options.Url=""; + }); +}); +``` + +`Options` 是 NATS.Client 客户端提供的配置, 你可以在这个[链接](http://nats-io.github.io/nats.net/class_n_a_t_s_1_1_client_1_1_options.html)找到更多详细信息。 diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 8c00d9e..1e3cc3c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -98,6 +98,7 @@ nav: - Amazon SQS: user-guide/en/transport/aws-sqs.md - Apache Kafka®: user-guide/en/transport/kafka.md - Azure Service Bus: user-guide/en/transport/azure-service-bus.md + - NATS: user-guide/en/transport/nats.md - RabbitMQ: user-guide/en/transport/rabbitmq.md - Redis Streams: user-guide/en/transport/redis-streams.md - In-Memory Queue: user-guide/en/transport/in-memory-queue.md @@ -133,6 +134,7 @@ nav: - Amazon SQS: user-guide/zh/transport/aws-sqs.md - Apache Kafka®: user-guide/zh/transport/kafka.md - Azure Service Bus: user-guide/zh/transport/azure-service-bus.md + - NATS: user-guide/zh/transport/nats.md - RabbitMQ: user-guide/zh/transport/rabbitmq.md - Redis Streams: user-guide/zh/transport/redis-streams.md - In-Memory Queue: user-guide/zh/transport/in-memory-queue.md