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
1a06783c
Commit
1a06783c
authored
Sep 22, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor.
parent
89e599a3
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
120 additions
and
46 deletions
+120
-46
CAP.AppBuilderExtensions.cs
src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs
+2
-5
CAP.DashboardOptionsExtensions.cs
...otNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs
+2
-3
DashboardContext.cs
src/DotNetCore.CAP/Dashboard/DashboardContext.cs
+3
-0
DashboardRequest.cs
src/DotNetCore.CAP/Dashboard/DashboardRequest.cs
+2
-2
DashboardRoutes.cs
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
+2
-1
HtmlHelper.cs
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
+8
-1
NodePage.cs
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs
+15
-7
NodePage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cshtml
+12
-4
NodePage1.generated.cs
src/DotNetCore.CAP/Dashboard/Pages/NodePage1.generated.cs
+51
-16
RazorPage.cs
src/DotNetCore.CAP/Dashboard/RazorPage.cs
+6
-4
UrlHelper.cs
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
+5
-0
CAP.DiscoveryOptionsExtensions.cs
...tCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs
+8
-2
INodeDiscoveryProvider.Consul.cs
...etCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs
+2
-1
Node.cs
src/DotNetCore.CAP/NodeDiscovery/Node.cs
+2
-0
No files found.
src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs
View file @
1a06783c
using
System
;
using
System
;
using
DotNetCore.CAP
;
using
DotNetCore.CAP
;
using
DotNetCore.CAP.Dashboard.GatewayProxy.Request.Middleware
;
using
DotNetCore.CAP.Dashboard.GatewayProxy
;
using
DotNetCore.CAP.Dashboard.GatewayProxy.Requester.Middleware
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
...
@@ -53,10 +52,8 @@ namespace Microsoft.AspNetCore.Builder
...
@@ -53,10 +52,8 @@ namespace Microsoft.AspNetCore.Builder
app
.
Map
(
new
PathString
(
pathMatch
),
x
=>
app
.
Map
(
new
PathString
(
pathMatch
),
x
=>
{
{
x
.
UseDownstreamRequestInitialiser
();
x
.
UseHttpRequestBuilderMiddleware
();
x
.
UseHttpRequesterMiddleware
();
x
.
UseMiddleware
<
DashboardMiddleware
>();
x
.
UseMiddleware
<
DashboardMiddleware
>();
x
.
UseMiddleware
<
GatewayProxyMiddleware
>();
});
});
return
app
;
return
app
;
...
...
src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs
View file @
1a06783c
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
...
@@ -26,7 +24,8 @@ namespace DotNetCore.CAP
...
@@ -26,7 +24,8 @@ namespace DotNetCore.CAP
services
.
AddSingleton
(
DashboardRoutes
.
Routes
);
services
.
AddSingleton
(
DashboardRoutes
.
Routes
);
services
.
AddSingleton
<
IHttpRequester
,
HttpClientHttpRequester
>();
services
.
AddSingleton
<
IHttpRequester
,
HttpClientHttpRequester
>();
services
.
AddSingleton
<
IHttpClientCache
,
MemoryHttpClientCache
>();
services
.
AddSingleton
<
IHttpClientCache
,
MemoryHttpClientCache
>();
services
.
AddSingleton
<
IRequestMapper
,
RequestMapper
>();
//services.AddScoped<IRequestScopedDataRepository, ScopedDataRepository>();
services
.
AddScoped
<
IRequestScopedDataRepository
,
HttpDataRepository
>();
services
.
AddScoped
<
IRequestScopedDataRepository
,
HttpDataRepository
>();
}
}
}
}
...
...
src/DotNetCore.CAP/Dashboard/DashboardContext.cs
View file @
1a06783c
...
@@ -25,6 +25,8 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -25,6 +25,8 @@ namespace DotNetCore.CAP.Dashboard
public
DashboardResponse
Response
{
get
;
protected
set
;
}
public
DashboardResponse
Response
{
get
;
protected
set
;
}
public
ISession
Session
{
get
;
protected
set
;
}
public
IServiceProvider
RequestServices
{
get
;
protected
set
;
}
public
IServiceProvider
RequestServices
{
get
;
protected
set
;
}
}
}
...
@@ -42,6 +44,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -42,6 +44,7 @@ namespace DotNetCore.CAP.Dashboard
Request
=
new
CapDashboardRequest
(
httpContext
);
Request
=
new
CapDashboardRequest
(
httpContext
);
Response
=
new
CapDashboardResponse
(
httpContext
);
Response
=
new
CapDashboardResponse
(
httpContext
);
RequestServices
=
httpContext
.
RequestServices
;
RequestServices
=
httpContext
.
RequestServices
;
Session
=
httpContext
.
Session
;
}
}
public
HttpContext
HttpContext
{
get
;
}
public
HttpContext
HttpContext
{
get
;
}
...
...
src/DotNetCore.CAP/Dashboard/DashboardRequest.cs
View file @
1a06783c
...
@@ -34,8 +34,8 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -34,8 +34,8 @@ namespace DotNetCore.CAP.Dashboard
public
override
string
PathBase
=>
_context
.
Request
.
PathBase
.
Value
;
public
override
string
PathBase
=>
_context
.
Request
.
PathBase
.
Value
;
public
override
string
LocalIpAddress
=>
_context
.
Connection
.
LocalIpAddress
.
ToString
();
public
override
string
LocalIpAddress
=>
_context
.
Connection
.
LocalIpAddress
.
ToString
();
public
override
string
RemoteIpAddress
=>
_context
.
Connection
.
RemoteIpAddress
.
ToString
();
public
override
string
RemoteIpAddress
=>
_context
.
Connection
.
RemoteIpAddress
.
ToString
();
public
override
string
GetQuery
(
string
key
)
=>
_context
.
Request
.
Query
[
key
];
public
override
string
GetQuery
(
string
key
)
=>
_context
.
Request
.
Query
[
key
];
public
override
async
Task
<
IList
<
string
>>
GetFormValuesAsync
(
string
key
)
public
override
async
Task
<
IList
<
string
>>
GetFormValuesAsync
(
string
key
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
View file @
1a06783c
...
@@ -107,7 +107,8 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -107,7 +107,8 @@ namespace DotNetCore.CAP.Dashboard
Routes
.
AddRazorPage
(
"/subscribers"
,
x
=>
new
SubscriberPage
());
Routes
.
AddRazorPage
(
"/subscribers"
,
x
=>
new
SubscriberPage
());
Routes
.
AddRazorPage
(
"/nodes"
,
x
=>
new
NodePage
());
Routes
.
AddRazorPage
(
"/nodes"
,
x
=>
new
NodePage
());
Routes
.
AddRazorPage
(
"/nodes/node/(?<Id>.+)"
,
x
=>
new
NodePage
(
x
.
Groups
[
"Id"
].
Value
));
#
endregion
Razor
pages
and
commands
#
endregion
Razor
pages
and
commands
}
}
...
...
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
View file @
1a06783c
...
@@ -190,6 +190,12 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -190,6 +190,12 @@ namespace DotNetCore.CAP.Dashboard
$"<span class=\"labe label-defult text-uppercase\" title=\"
{
serverId
}
\">
{
shortenedId
}
</span>"
);
$"<span class=\"labe label-defult text-uppercase\" title=\"
{
serverId
}
\">
{
shortenedId
}
</span>"
);
}
}
public
NonEscapedString
NodeSwitchLink
(
string
id
)
{
return
Raw
(
$"<a class=\"job-method\" href=\"
{
_page
.
Url
.
NodeSwitch
(
id
)}
\">
{
Strings
.
NodePage_Switch
}
</a>"
);
}
#
region
MethodEscaped
public
NonEscapedString
MethodEscaped
(
MethodInfo
method
)
public
NonEscapedString
MethodEscaped
(
MethodInfo
method
)
{
{
var
outputString
=
string
.
Empty
;
var
outputString
=
string
.
Empty
;
...
@@ -288,7 +294,8 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -288,7 +294,8 @@ namespace DotNetCore.CAP.Dashboard
private
string
Span
(
string
@class
,
string
value
)
private
string
Span
(
string
@class
,
string
value
)
{
{
return
$"<span class=\"
{
@class
}
\">
{
value
}
</span>"
;
return
$"<span class=\"
{
@class
}
\">
{
value
}
</span>"
;
}
}
#
endregion
public
NonEscapedString
StackTrace
(
string
stackTrace
)
public
NonEscapedString
StackTrace
(
string
stackTrace
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs
View file @
1a06783c
...
@@ -8,6 +8,19 @@ namespace DotNetCore.CAP.Dashboard.Pages
...
@@ -8,6 +8,19 @@ namespace DotNetCore.CAP.Dashboard.Pages
partial
class
NodePage
partial
class
NodePage
{
{
private
IList
<
Node
>
_nodes
=
null
;
private
IList
<
Node
>
_nodes
=
null
;
private
INodeDiscoveryProvider
_discoveryProvider
;
public
NodePage
()
{
}
public
NodePage
(
string
id
)
{
CurrentNodeId
=
id
;
}
public
string
CurrentNodeId
{
get
;
set
;
}
public
IList
<
Node
>
Nodes
public
IList
<
Node
>
Nodes
{
{
...
@@ -15,13 +28,8 @@ namespace DotNetCore.CAP.Dashboard.Pages
...
@@ -15,13 +28,8 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
{
if
(
_nodes
==
null
)
if
(
_nodes
==
null
)
{
{
var
configOptions
=
RequestServices
.
GetService
<
DiscoveryOptions
>();
_discoveryProvider
=
RequestServices
.
GetService
<
INodeDiscoveryProvider
>();
_nodes
=
_discoveryProvider
.
GetNodes
().
GetAwaiter
().
GetResult
();
var
factory
=
RequestServices
.
GetService
<
IDiscoveryProviderFactory
>();
var
discoryProvider
=
factory
.
Create
(
configOptions
);
_nodes
=
discoryProvider
.
GetNodes
().
GetAwaiter
().
GetResult
();
}
}
return
_nodes
;
return
_nodes
;
}
}
...
...
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cshtml
View file @
1a06783c
...
@@ -5,23 +5,28 @@
...
@@ -5,23 +5,28 @@
@inherits RazorPage
@inherits RazorPage
@{
@{
Layout = new LayoutPage(Strings.NodePage_Title);
Layout = new LayoutPage(Strings.NodePage_Title);
if (CurrentNodeId != null)
{
Session.Set("cap_current_node",System.Text.Encoding.Default.GetBytes(CurrentNodeId));
}
}
}
<div class="row">
<div class="row">
<div class="col-md-12">
<div class="col-md-12">
<h1 class="page-header">@Strings.NodePage_Title</h1>
<h1 class="page-header">@Strings.NodePage_Title</h1>
@if (Nodes == null || Nodes.Count
==
0)
@if (Nodes == null || Nodes.Count
==
0)
{
{
<div class="alert alert-warning">
<div class="alert alert-warning">
@Strings.NodePage_NoNodes
@Strings.NodePage_NoNodes
</div>
</div>
}
}
else
else
{
{
<div class="table-responsive">
<div class="table-responsive">
<table class="table">
<table class="table">
<thead>
<thead>
<tr>
<tr>
<th width="10%">编号</th>
<th width="20%">节点名称</th>
<th width="20%">节点名称</th>
<th width="20%">IP地址</th>
<th width="20%">IP地址</th>
<th width="7%">端口号</th>
<th width="7%">端口号</th>
...
@@ -32,12 +37,15 @@
...
@@ -32,12 +37,15 @@
<tbody>
<tbody>
@foreach (var node in Nodes)
@foreach (var node in Nodes)
{
{
<tr>
<tr class="@(CurrentNodeId == node.Id? "active":null )">
<td>@node.Id</td>
<td>@node.Name</td>
<td>@node.Name</td>
<td>@node.Address</td>
<td>@node.Address</td>
<td>@node.Port</td>
<td>@node.Port</td>
<td>@node.Tags</td>
<td>@node.Tags</td>
<td><a href="javascript:;" class="btn-link">切换到</a></td>
<td>
@Html.NodeSwitchLink(node.Id)
</td>
</tr>
</tr>
}
}
</tbody>
</tbody>
...
...
src/DotNetCore.CAP/Dashboard/Pages/NodePage1.generated.cs
View file @
1a06783c
...
@@ -54,6 +54,10 @@ WriteLiteral("\r\n");
...
@@ -54,6 +54,10 @@ WriteLiteral("\r\n");
#
line
6
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
6
"..\..\Dashboard\Pages\NodePage.cshtml"
Layout
=
new
LayoutPage
(
Strings
.
NodePage_Title
);
Layout
=
new
LayoutPage
(
Strings
.
NodePage_Title
);
if
(
CurrentNodeId
!=
null
)
{
Session
.
Set
(
"cap_current_node"
,
System
.
Text
.
Encoding
.
Default
.
GetBytes
(
CurrentNodeId
));
}
...
@@ -63,7 +67,7 @@ WriteLiteral("<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n <h
...
@@ -63,7 +67,7 @@ WriteLiteral("<div class=\"row\">\r\n <div class=\"col-md-12\">\r\n <h
#
line
1
1
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
1
5
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
Strings
.
NodePage_Title
);
Write
(
Strings
.
NodePage_Title
);
...
@@ -73,8 +77,8 @@ WriteLiteral("</h1>\r\n\r\n");
...
@@ -73,8 +77,8 @@ WriteLiteral("</h1>\r\n\r\n");
#
line
1
3
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
1
7
"..\..\Dashboard\Pages\NodePage.cshtml"
if
(
Nodes
==
null
||
Nodes
.
Count
==
0
)
if
(
Nodes
==
null
||
Nodes
.
Count
==
0
)
{
{
...
@@ -84,7 +88,7 @@ WriteLiteral(" <div class=\"alert alert-warning\">\r\n
...
@@ -84,7 +88,7 @@ WriteLiteral(" <div class=\"alert alert-warning\">\r\n
#
line
16
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
20
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
Strings
.
NodePage_NoNodes
);
Write
(
Strings
.
NodePage_NoNodes
);
...
@@ -94,10 +98,10 @@ WriteLiteral("\r\n </div>\r\n");
...
@@ -94,10 +98,10 @@ WriteLiteral("\r\n </div>\r\n");
#
line
18
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
22
"..\..\Dashboard\Pages\NodePage.cshtml"
}
}
else
else
{
{
#
line
default
#
line
default
...
@@ -106,6 +110,7 @@ WriteLiteral(@" <div class=""table-responsive"">
...
@@ -106,6 +110,7 @@ WriteLiteral(@" <div class=""table-responsive"">
<table class=""table"">
<table class=""table"">
<thead>
<thead>
<tr>
<tr>
<th width=""10%"">编号</th>
<th width=""20%"">节点名称</th>
<th width=""20%"">节点名称</th>
<th width=""20%"">IP地址</th>
<th width=""20%"">IP地址</th>
<th width=""7%"">端口号</th>
<th width=""7%"">端口号</th>
...
@@ -118,18 +123,38 @@ WriteLiteral(@" <div class=""table-responsive"">
...
@@ -118,18 +123,38 @@ WriteLiteral(@" <div class=""table-responsive"">
#
line
3
3
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
3
8
"..\..\Dashboard\Pages\NodePage.cshtml"
foreach
(
var
node
in
Nodes
)
foreach
(
var
node
in
Nodes
)
{
{
#
line
default
#
line
default
#
line
hidden
#
line
hidden
WriteLiteral
(
" <tr
>\r\n <td>
"
);
WriteLiteral
(
" <tr
class=\"
"
);
#
line
36
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
40
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
CurrentNodeId
==
node
.
Id
?
"active"
:
null
);
#
line
default
#
line
hidden
WriteLiteral
(
"\">\r\n <td>"
);
#
line
41
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
node
.
Id
);
#
line
default
#
line
hidden
WriteLiteral
(
"</td>\r\n <td>"
);
#
line
42
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
node
.
Name
);
Write
(
node
.
Name
);
...
@@ -139,7 +164,7 @@ WriteLiteral("</td>\r\n <td>");
...
@@ -139,7 +164,7 @@ WriteLiteral("</td>\r\n <td>");
#
line
37
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
43
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
node
.
Address
);
Write
(
node
.
Address
);
...
@@ -149,7 +174,7 @@ WriteLiteral("</td>\r\n <td>");
...
@@ -149,7 +174,7 @@ WriteLiteral("</td>\r\n <td>");
#
line
38
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
44
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
node
.
Port
);
Write
(
node
.
Port
);
...
@@ -159,18 +184,28 @@ WriteLiteral("</td>\r\n <td>");
...
@@ -159,18 +184,28 @@ WriteLiteral("</td>\r\n <td>");
#
line
39
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
45
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
node
.
Tags
);
Write
(
node
.
Tags
);
#
line
default
#
line
default
#
line
hidden
#
line
hidden
WriteLiteral
(
"</td>\r\n <td>
<a class=\"btn\">切换到</a></td>\r\n
"
+
WriteLiteral
(
"</td>\r\n <td>
\r\n
"
+
"
</tr>\r\n
"
);
""
);
#
line
42
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
47
"..\..\Dashboard\Pages\NodePage.cshtml"
Write
(
Html
.
NodeSwitchLink
(
node
.
Id
));
#
line
default
#
line
hidden
WriteLiteral
(
"\r\n </td>\r\n </tr>\r\n"
);
#
line
50
"..\..\Dashboard\Pages\NodePage.cshtml"
}
}
...
@@ -180,7 +215,7 @@ WriteLiteral(" </tbody>\r\n </table>\r\n
...
@@ -180,7 +215,7 @@ WriteLiteral(" </tbody>\r\n </table>\r\n
#
line
46
"..\..\Dashboard\Pages\NodePage.cshtml"
#
line
54
"..\..\Dashboard\Pages\NodePage.cshtml"
}
}
...
...
src/DotNetCore.CAP/Dashboard/RazorPage.cs
View file @
1a06783c
...
@@ -3,6 +3,7 @@ using System.Diagnostics;
...
@@ -3,6 +3,7 @@ using System.Diagnostics;
using
System.Net
;
using
System.Net
;
using
System.Text
;
using
System.Text
;
using
DotNetCore.CAP.Dashboard.Monitoring
;
using
DotNetCore.CAP.Dashboard.Monitoring
;
using
Microsoft.AspNetCore.Http
;
namespace
DotNetCore.CAP.Dashboard
namespace
DotNetCore.CAP.Dashboard
{
{
...
@@ -37,9 +38,9 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -37,9 +38,9 @@ namespace DotNetCore.CAP.Dashboard
}
}
}
}
internal
DashboardRequest
Request
{
private
get
;
set
;
}
protected
DashboardRequest
Request
{
private
get
;
set
;
}
internal
DashboardResponse
Response
{
private
get
;
set
;
}
protected
DashboardResponse
Response
{
private
get
;
set
;
}
internal
ISession
Session
{
get
;
private
set
;
}
internal
IServiceProvider
RequestServices
{
get
;
private
set
;
}
internal
IServiceProvider
RequestServices
{
get
;
private
set
;
}
public
string
RequestPath
=>
Request
.
Path
;
public
string
RequestPath
=>
Request
.
Path
;
...
@@ -67,6 +68,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -67,6 +68,7 @@ namespace DotNetCore.CAP.Dashboard
StatsPollingInterval
=
parentPage
.
StatsPollingInterval
;
StatsPollingInterval
=
parentPage
.
StatsPollingInterval
;
Url
=
parentPage
.
Url
;
Url
=
parentPage
.
Url
;
RequestServices
=
parentPage
.
RequestServices
;
RequestServices
=
parentPage
.
RequestServices
;
Session
=
parentPage
.
Session
;
GenerationTime
=
parentPage
.
GenerationTime
;
GenerationTime
=
parentPage
.
GenerationTime
;
_statisticsLazy
=
parentPage
.
_statisticsLazy
;
_statisticsLazy
=
parentPage
.
_statisticsLazy
;
...
@@ -77,7 +79,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -77,7 +79,7 @@ namespace DotNetCore.CAP.Dashboard
Request
=
context
.
Request
;
Request
=
context
.
Request
;
Response
=
context
.
Response
;
Response
=
context
.
Response
;
RequestServices
=
context
.
RequestServices
;
RequestServices
=
context
.
RequestServices
;
Session
=
context
.
Session
;
Storage
=
context
.
Storage
;
Storage
=
context
.
Storage
;
AppPath
=
context
.
Options
.
AppPath
;
AppPath
=
context
.
Options
.
AppPath
;
StatsPollingInterval
=
context
.
Options
.
StatsPollingInterval
;
StatsPollingInterval
=
context
.
Options
.
StatsPollingInterval
;
...
...
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
View file @
1a06783c
...
@@ -29,6 +29,11 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -29,6 +29,11 @@ namespace DotNetCore.CAP.Dashboard
return
To
(
"/jobs/details/"
+
jobId
);
return
To
(
"/jobs/details/"
+
jobId
);
}
}
public
string
NodeSwitch
(
string
id
)
{
return
To
(
"/nodes/node/"
+
id
);
}
public
string
LinkToPublished
()
public
string
LinkToPublished
()
{
{
return
To
(
"/published/succeeded"
);
return
To
(
"/published/succeeded"
);
...
...
src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs
View file @
1a06783c
...
@@ -21,10 +21,16 @@ namespace DotNetCore.CAP
...
@@ -21,10 +21,16 @@ namespace DotNetCore.CAP
var
discoveryOptions
=
new
DiscoveryOptions
();
var
discoveryOptions
=
new
DiscoveryOptions
();
_options
?.
Invoke
(
discoveryOptions
);
_options
?.
Invoke
(
discoveryOptions
);
services
.
AddSingleton
(
discoveryOptions
);
services
.
AddSingleton
(
discoveryOptions
);
services
.
AddSingleton
<
IDiscoveryProviderFactory
,
DiscoveryProviderFactory
>();
services
.
AddSingleton
<
IDiscoveryProviderFactory
,
DiscoveryProviderFactory
>();
services
.
AddSingleton
<
IProcessingServer
,
ConsulProcessingNodeServer
>();
services
.
AddSingleton
<
IProcessingServer
,
ConsulProcessingNodeServer
>();
services
.
AddSingleton
<
INodeDiscoveryProvider
>(
x
=>
{
var
configOptions
=
x
.
GetService
<
DiscoveryOptions
>();
var
factory
=
x
.
GetService
<
IDiscoveryProviderFactory
>();
return
factory
.
Create
(
configOptions
);
});
}
}
}
}
}
}
...
@@ -37,7 +43,7 @@ namespace Microsoft.Extensions.DependencyInjection
...
@@ -37,7 +43,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
{
public
static
CapOptions
UseDiscovery
(
this
CapOptions
capOptions
)
public
static
CapOptions
UseDiscovery
(
this
CapOptions
capOptions
)
{
{
return
capOptions
.
UseDiscovery
(
opt
=>
{});
return
capOptions
.
UseDiscovery
(
opt
=>
{
});
}
}
public
static
CapOptions
UseDiscovery
(
this
CapOptions
capOptions
,
Action
<
DiscoveryOptions
>
options
)
public
static
CapOptions
UseDiscovery
(
this
CapOptions
capOptions
,
Action
<
DiscoveryOptions
>
options
)
...
...
src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs
View file @
1a06783c
...
@@ -4,6 +4,7 @@ using System.Collections.Generic;
...
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Consul
;
using
Consul
;
using
System.Security.Cryptography
;
namespace
DotNetCore.CAP.NodeDiscovery
namespace
DotNetCore.CAP.NodeDiscovery
{
{
...
@@ -33,7 +34,7 @@ namespace DotNetCore.CAP.NodeDiscovery
...
@@ -33,7 +34,7 @@ namespace DotNetCore.CAP.NodeDiscovery
var
nodes
=
services
.
Response
.
Select
(
x
=>
new
Node
var
nodes
=
services
.
Response
.
Select
(
x
=>
new
Node
{
{
Name
=
x
.
Key
,
Name
=
x
.
Value
.
Service
,
Address
=
x
.
Value
.
Address
,
Address
=
x
.
Value
.
Address
,
Port
=
x
.
Value
.
Port
,
Port
=
x
.
Value
.
Port
,
Tags
=
string
.
Join
(
", "
,
x
.
Value
.
Tags
)
Tags
=
string
.
Join
(
", "
,
x
.
Value
.
Tags
)
...
...
src/DotNetCore.CAP/NodeDiscovery/Node.cs
View file @
1a06783c
...
@@ -6,6 +6,8 @@ namespace DotNetCore.CAP.NodeDiscovery
...
@@ -6,6 +6,8 @@ namespace DotNetCore.CAP.NodeDiscovery
{
{
class
Node
class
Node
{
{
public
string
Id
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Address
{
get
;
set
;
}
public
string
Address
{
get
;
set
;
}
...
...
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