Commit 081fcd42 authored by yangxiaodong's avatar yangxiaodong

Merge branch 'master' of https://github.com/dotnetcore/CAP

parents 4aa25520 d3dcca19
...@@ -16,7 +16,7 @@ CAP has the function of Message Presistence, and it makes messages reliability w ...@@ -16,7 +16,7 @@ CAP has the function of Message Presistence, and it makes messages reliability w
This is a diagram of the CAP working in the ASP.NET Core MicroService architecture: This is a diagram of the CAP working in the ASP.NET Core MicroService architecture:
![](http://images2015.cnblogs.com/blog/250417/201706/250417-20170630143600289-1065294295.png) ![](http://images2015.cnblogs.com/blog/250417/201707/250417-20170705175827128-1203291469.png)
> The solid line in the figure represents the user code, and the dotted line represents the internal implementation of the CAP. > The solid line in the figure represents the user code, and the dotted line represents the internal implementation of the CAP.
...@@ -29,19 +29,19 @@ You can run the following command to install the CAP in your project. ...@@ -29,19 +29,19 @@ You can run the following command to install the CAP in your project.
If your Message Queue is using Kafka, you can: If your Message Queue is using Kafka, you can:
``` ```
PM> Install-Package DotNetCore.CAP.Kafka PM> Install-Package DotNetCore.CAP.Kafka -Pre
``` ```
or RabbitMQ: or RabbitMQ:
``` ```
PM> Install-Package DotNetCore.CAP.RabbitMQ PM> Install-Package DotNetCore.CAP.RabbitMQ -Pre
``` ```
CAP provides EntityFramework as default database store extension : CAP provides EntityFramework as default database store extension :
``` ```
PM> Install-Package DotNetCore.CAP.EntityFrameworkCore PM> Install-Package DotNetCore.CAP.EntityFrameworkCore -Pre
``` ```
### Configuration ### Configuration
...@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services) ...@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddCap() services.AddCap()
.AddEntityFrameworkStores<AppDbContext>() .AddEntityFrameworkStores<AppDbContext>()
.AddKafka(x => x.Servers = "localhost:9453"); .AddKafka(x => x.Servers = "localhost:9092");
} }
public void Configure(IApplicationBuilder app) public void Configure(IApplicationBuilder app)
...@@ -100,9 +100,7 @@ public class PublishController : Controller ...@@ -100,9 +100,7 @@ public class PublishController : Controller
**Action Method** **Action Method**
Add Attribute on Action to subscribe message: Add the Attribute `[CapSubscribe()]` on Action to subscribe message:
If you are using Kafka the Attribute is `[KafkaTopic()]`, and RabbitMQ is `[RabbitMQTopic()]`
```cs ```cs
public class PublishController : Controller public class PublishController : Controller
...@@ -116,7 +114,7 @@ public class PublishController : Controller ...@@ -116,7 +114,7 @@ public class PublishController : Controller
[NoAction] [NoAction]
[KafkaTopic("xxx.services.account.check")] [CapSubscribe("xxx.services.account.check")]
public async Task CheckReceivedMessage(Person person) public async Task CheckReceivedMessage(Person person)
{ {
Console.WriteLine(person.Name); Console.WriteLine(person.Name);
...@@ -129,7 +127,7 @@ public class PublishController : Controller ...@@ -129,7 +127,7 @@ public class PublishController : Controller
**Service Method** **Service Method**
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance `IConsumerService`: If your subscribe method is not in the Controller,then your subscribe class need to Inheritance `ICapSubscribe`:
```cs ```cs
...@@ -141,9 +139,9 @@ namespace xxx.Service ...@@ -141,9 +139,9 @@ namespace xxx.Service
} }
public class SubscriberService: ISubscriberService, IConsumerService public class SubscriberService: ISubscriberService, ICapSubscribe
{ {
[KafkaTopic("xxx.services.account.check")] [CapSubscribe("xxx.services.account.check")]
public void CheckReceivedMessage(Person person) public void CheckReceivedMessage(Person person)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment