Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
081fcd42
Commit
081fcd42
authored
Jul 06, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/dotnetcore/CAP
parents
4aa25520
d3dcca19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
README.md
README.md
+10
-12
No files found.
README.md
View file @
081fcd42
...
...
@@ -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:


> 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.
If your Message Queue is using Kafka, you can:
```
PM> Install-Package DotNetCore.CAP.Kafka
PM> Install-Package DotNetCore.CAP.Kafka
-Pre
```
or RabbitMQ:
```
PM> Install-Package DotNetCore.CAP.RabbitMQ
PM> Install-Package DotNetCore.CAP.RabbitMQ
-Pre
```
CAP provides EntityFramework as default database store extension :
```
PM> Install-Package DotNetCore.CAP.EntityFrameworkCore
PM> Install-Package DotNetCore.CAP.EntityFrameworkCore
-Pre
```
### Configuration
...
...
@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services)
services
.
AddCap
()
.
AddEntityFrameworkStores
<
AppDbContext
>()
.
AddKafka
(
x
=>
x
.
Servers
=
"localhost:9
453
"
);
.
AddKafka
(
x
=>
x
.
Servers
=
"localhost:9
092
"
);
}
public
void
Configure
(
IApplicationBuilder
app
)
...
...
@@ -100,9 +100,7 @@ public class PublishController : Controller
**Action Method**
Add Attribute on Action to subscribe message:
If you are using Kafka the Attribute is
`[KafkaTopic()]`
, and RabbitMQ is
`[RabbitMQTopic()]`
Add the Attribute
`[CapSubscribe()]`
on Action to subscribe message:
```
cs
public
class
PublishController
:
Controller
...
...
@@ -116,7 +114,7 @@ public class PublishController : Controller
[
NoAction
]
[
KafkaTopic
(
"xxx.services.account.check"
)]
[
CapSubscribe
(
"xxx.services.account.check"
)]
public
async
Task
CheckReceivedMessage
(
Person
person
)
{
Console
.
WriteLine
(
person
.
Name
);
...
...
@@ -129,7 +127,7 @@ public class PublishController : Controller
**Service Method**
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance
`IC
onsumerServic
e`
:
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance
`IC
apSubscrib
e`
:
```
cs
...
...
@@ -141,9 +139,9 @@ namespace xxx.Service
}
public
class
SubscriberService
:
ISubscriberService
,
IC
onsumerServic
e
public
class
SubscriberService
:
ISubscriberService
,
IC
apSubscrib
e
{
[
KafkaTopic
(
"xxx.services.account.check"
)]
[
CapSubscribe
(
"xxx.services.account.check"
)]
public
void
CheckReceivedMessage
(
Person
person
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment