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
767008a3
Commit
767008a3
authored
Oct 01, 2017
by
yuleyule66
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dashboard instructions to readme
parent
f1304ceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
README.zh-cn.md
README.zh-cn.md
+34
-5
No files found.
README.zh-cn.md
View file @
767008a3
...
...
@@ -59,7 +59,7 @@ PM> Install-Package DotNetCore.CAP.PostgreSql
首先配置CAP到 Startup.cs 文件中,如下:
```
c
s
```
c
#
public
void
ConfigureServices
(
IServiceCollection
services
)
{
......
...
...
@@ -96,7 +96,7 @@ public void Configure(IApplicationBuilder app)
在 Controller 中注入
`ICapPublisher`
然后使用
`ICapPublisher`
进行消息发送
```
c
s
```
c
#
public
class
PublishController
:
Controller
{
private
readonly
ICapPublisher
_publisher
;
...
...
@@ -137,7 +137,7 @@ public class PublishController : Controller
在 Action 上添加 CapSubscribeAttribute 来订阅相关消息。
```
c
s
```
c
#
public
class
PublishController
:
Controller
{
private
readonly
ICapPublisher
_publisher
;
...
...
@@ -164,7 +164,7 @@ public class PublishController : Controller
如果你的订阅方法没有位于 Controller 中,则你订阅的类需要继承
`ICapSubscribe`
:
```
c
s
```
c
#
namespace
xxx.Service
{
...
...
@@ -188,13 +188,42 @@ namespace xxx.Service
然后在 Startup.cs 中的
`ConfigureServices()`
中注入你的
`ISubscriberService`
类
```
c
s
```
c
#
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddTransient
<
ISubscriberService
,
SubscriberService
>();
}
```
### Dashboard
CAP 2.1+ 以上版本中提供了仪表盘(Dashboard)功能,你可以很方便的查看发出和接收到的消息。除此之外,你还可以在仪表盘中实时查看发送或者接收到的消息。
在分布式环境中,仪表盘内置集成了
[
Consul
](
http://consul.io
)
作为节点的注册发现,同时实现了网关代理功能,你同样可以方便的查看本节点或者其他节点的数据,它就像你访问本地资源一样。
```
c#
services
.
AddCap
(
x
=>
{
//...
// 注册 Dashboard
x
.
UseDashboard
();
// 注册节点到 Consul
x
.
UseDiscovery
(
d
=>
{
d
.
DiscoveryServerHostName
=
"localhost"
;
d
.
DiscoveryServerPort
=
8500
;
d
.
CurrentNodeHostName
=
"localhost"
;
d
.
CurrentNodePort
=
5800
;
d
.
NodeId
=
1
;
d
.
NodeName
=
"CAP No.1 Node"
;
});
});
```
## 贡献
贡献的最简单的方法之一就是是参与讨论和讨论问题(issue)。你也可以通过提交的 Pull Request 代码变更作出贡献。
...
...
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