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
4abfb252
Commit
4abfb252
authored
Aug 30, 2018
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format
parent
414cf26b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
README.md
README.md
+12
-12
No files found.
README.md
View file @
4abfb252
...
@@ -35,7 +35,7 @@ PM> Install-Package DotNetCore.CAP.Kafka
...
@@ -35,7 +35,7 @@ PM> Install-Package DotNetCore.CAP.Kafka
PM> Install-Package DotNetCore.CAP.RabbitMQ
PM> Install-Package DotNetCore.CAP.RabbitMQ
```
```
CAP supports SqlServer, MySql, PostgreSql,MongoDB as event log storage.
CAP supports SqlServer, MySql, PostgreSql,MongoDB as event log storage.
```
```
// select a database provider you are using, event log table will integrate into.
// select a database provider you are using, event log table will integrate into.
...
@@ -56,7 +56,7 @@ public void ConfigureServices(IServiceCollection services)
...
@@ -56,7 +56,7 @@ public void ConfigureServices(IServiceCollection services)
//......
//......
services
.
AddDbContext
<
AppDbContext
>();
//Options, If you are using EF as the ORM
services
.
AddDbContext
<
AppDbContext
>();
//Options, If you are using EF as the ORM
services
.
AddSingleton
<
IMongoClient
>(
new
MongoClient
(
""
));
//Options, If you are using MongoDB
services
.
AddSingleton
<
IMongoClient
>(
new
MongoClient
(
""
));
//Options, If you are using MongoDB
services
.
AddCap
(
x
=>
services
.
AddCap
(
x
=>
{
{
...
@@ -68,9 +68,9 @@ public void ConfigureServices(IServiceCollection services)
...
@@ -68,9 +68,9 @@ public void ConfigureServices(IServiceCollection services)
x
.
UseMySql
(
"Your ConnectionStrings"
);
x
.
UseMySql
(
"Your ConnectionStrings"
);
x
.
UsePostgreSql
(
"Your ConnectionStrings"
);
x
.
UsePostgreSql
(
"Your ConnectionStrings"
);
// If you are using MongoDB, you need to add the configuration:
// If you are using MongoDB, you need to add the configuration:
x
.
UseMongoDB
(
"Your ConnectionStrings"
);
//MongoDB 4.0+ cluster
x
.
UseMongoDB
(
"Your ConnectionStrings"
);
//MongoDB 4.0+ cluster
// If you are using RabbitMQ, you need to add the configuration:
// If you are using RabbitMQ, you need to add the configuration:
x
.
UseRabbitMQ
(
"localhost"
);
x
.
UseRabbitMQ
(
"localhost"
);
...
@@ -88,7 +88,7 @@ Inject `ICapPublisher` in your Controller, then use the `ICapPublisher` to send
...
@@ -88,7 +88,7 @@ Inject `ICapPublisher` in your Controller, then use the `ICapPublisher` to send
```
c#
```
c#
public
class
PublishController
:
Controller
public
class
PublishController
:
Controller
{
{
private
readonly
ICapPublisher
_capBus
;
private
readonly
ICapPublisher
_capBus
;
public
PublishController
(
ICapPublisher
capPublisher
)
public
PublishController
(
ICapPublisher
capPublisher
)
{
{
...
@@ -118,7 +118,7 @@ public class PublishController : Controller
...
@@ -118,7 +118,7 @@ public class PublishController : Controller
{
{
//your business code
//your business code
_capBus
.
Publish
(
""
xxx
.
services
.
show
.
time
", DateTime.Now);
_capBus
.
Publish
(
""
xxx
.
services
.
show
.
time
", DateTime.Now);
}
}
return
Ok
();
return
Ok
();
...
@@ -147,7 +147,7 @@ public class PublishController : Controller
...
@@ -147,7 +147,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
`ICapSubscribe`
:
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance
`ICapSubscribe`
:
```
c#
```
c#
...
@@ -169,14 +169,14 @@ namespace xxx.Service
...
@@ -169,14 +169,14 @@ namespace xxx.Service
```
```
Then inject your
`ISubscriberService`
class in Startup.cs
Then inject your
`ISubscriberService`
class in Startup.cs
```
c#
```
c#
public
void
ConfigureServices
(
IServiceCollection
services
)
public
void
ConfigureServices
(
IServiceCollection
services
)
{
{
//Note: The injection of services needs before of `services.AddCap()`
//Note: The injection of services needs before of `services.AddCap()`
services
.
AddTransient
<
ISubscriberService
,
SubscriberService
>();
services
.
AddTransient
<
ISubscriberService
,
SubscriberService
>();
services
.
AddCap
(
x
=>{});
services
.
AddCap
(
x
=>{});
}
}
```
```
...
@@ -191,10 +191,10 @@ In the distributed environment, the dashboard built-in integrated [Consul](http:
...
@@ -191,10 +191,10 @@ In the distributed environment, the dashboard built-in integrated [Consul](http:
services
.
AddCap
(
x
=>
services
.
AddCap
(
x
=>
{
{
//...
//...
// Register Dashboard
// Register Dashboard
x
.
UseDashboard
();
x
.
UseDashboard
();
// Register to Consul
// Register to Consul
x
.
UseDiscovery
(
d
=>
x
.
UseDiscovery
(
d
=>
{
{
...
...
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