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
bfd9ea4e
Commit
bfd9ea4e
authored
Sep 27, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup code.
parent
595adb76
Changes
76
Show whitespace changes
Inline
Side-by-side
Showing
76 changed files
with
238 additions
and
381 deletions
+238
-381
CapPublisher.cs
src/DotNetCore.CAP.MySql/CapPublisher.cs
+2
-2
IAdditionalProcessor.Default.cs
src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs
+3
-7
MySqlStorageConnection.cs
src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs
+1
-1
MySqlStorageTransaction.cs
src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs
+1
-1
CapPublisher.cs
src/DotNetCore.CAP.PostgreSql/CapPublisher.cs
+2
-2
PostgreSqlStorage.cs
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs
+0
-1
PostgreSqlStorageConnection.cs
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
+1
-1
PostgreSqlStorageTransaction.cs
...DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs
+1
-1
CAP.RabbiMQOptions.cs
src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
+1
-3
IConnectionPool.cs
src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs
+1
-4
RabbitMQConsumerClient.cs
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs
+2
-2
RabbitMQConsumerClientFactory.cs
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs
+1
-4
CapPublisher.cs
src/DotNetCore.CAP.SqlServer/CapPublisher.cs
+2
-2
IAdditionalProcessor.Default.cs
src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs
+2
-6
SqlServerMonitoringApi.cs
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
+17
-41
SqlServerStorageConnection.cs
src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs
+1
-1
SqlServerStorageTransaction.cs
src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs
+1
-1
IConsumerServiceSelector.cs
src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs
+1
-3
ModelBindingResult.cs
...tCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs
+1
-1
TopicAttribute.cs
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
+1
-5
CAP.AppBuilderExtensions.cs
src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs
+2
-1
CAP.Builder.cs
src/DotNetCore.CAP/CAP.Builder.cs
+1
-1
CAP.Options.cs
src/DotNetCore.CAP/CAP.Options.cs
+1
-1
CAP.ServiceCollectionExtensions.cs
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
+1
-2
CapCache.cs
src/DotNetCore.CAP/CapCache.cs
+39
-39
CAP.DashboardMiddleware.cs
src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs
+10
-13
CAP.DashboardOptions.cs
src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs
+2
-3
CAP.DashboardOptionsExtensions.cs
...otNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs
+3
-5
cap.css
src/DotNetCore.CAP/Dashboard/Content/css/cap.css
+7
-3
cap.js
src/DotNetCore.CAP/Dashboard/Content/js/cap.js
+2
-2
DashboardResponse.cs
src/DotNetCore.CAP/Dashboard/DashboardResponse.cs
+5
-6
DashboardRoutes.cs
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
+0
-5
EmbeddedResourceDispatcher.cs
src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs
+10
-6
DownstreamUrl.cs
src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs
+1
-1
GatewayProxyMiddleware.cs
...Core.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs
+4
-7
HttpClientHttpRequester.cs
...shboard/GatewayProxy/Requester/HttpClientHttpRequester.cs
+1
-1
IHttpClientBuilder.cs
...AP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs
+3
-1
MemoryHttpClientCache.cs
...Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs
+4
-8
HtmlHelper.cs
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
+6
-25
JobHistoryRenderer.cs
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
+0
-2
JsonDispatcher.cs
src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs
+0
-3
BlockMetric.cs
src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs
+1
-1
Breadcrumbs.cs
src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs
+1
-1
NodePage.cs
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs
+3
-4
PublishedPage.cs
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs
+3
-6
ReceivedPage.cs
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs
+3
-6
SidebarMenu.cs
src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs
+2
-3
SubscriberPage.cshtml
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml
+1
-1
RouteCollectionExtensions.cs
src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs
+3
-3
UrlHelper.cs
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
+1
-2
IBootstrapper.Default.cs
src/DotNetCore.CAP/IBootstrapper.Default.cs
+1
-2
IConsumerHandler.Default.cs
src/DotNetCore.CAP/IConsumerHandler.Default.cs
+5
-12
IProcessingServer.cs
src/DotNetCore.CAP/IProcessingServer.cs
+1
-0
IQueueExecutor.Publish.Base.cs
src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs
+2
-3
IQueueExecutor.Subscibe.cs
src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs
+1
-1
Helper.cs
src/DotNetCore.CAP/Infrastructure/Helper.cs
+8
-9
IConsumerInvoker.Default.cs
src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs
+4
-13
IConsumerServiceSelector.Default.cs
...tNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs
+5
-5
IModelBinder.SimpleType.cs
src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs
+1
-1
ModelBinderFactory.cs
src/DotNetCore.CAP/Internal/ModelBinderFactory.cs
+1
-1
LoggerExtensions.cs
src/DotNetCore.CAP/LoggerExtensions.cs
+5
-5
CAP.DiscoveryOptions.cs
src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs
+3
-2
CAP.DiscoveryOptionsExtensions.cs
...tCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs
+1
-3
IDiscoveryProviderFactory.Default.cs
...re.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs
+1
-3
IDiscoveryProviderFactory.cs
...DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs
+2
-6
INodeDiscoveryProvider.Consul.cs
...etCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs
+4
-3
INodeDiscoveryProvider.cs
src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs
+1
-3
IProcessingServer.Consul.cs
src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs
+7
-11
Node.cs
src/DotNetCore.CAP/NodeDiscovery/Node.cs
+1
-5
OperateResult.cs
src/DotNetCore.CAP/OperateResult.cs
+5
-2
IDispatcher.Default.cs
src/DotNetCore.CAP/Processor/IDispatcher.Default.cs
+3
-13
IProcessingServer.Cap.cs
src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs
+3
-3
IProcessor.PublishQueuer.cs
src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs
+3
-3
IProcessor.SubscribeQueuer.cs
src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs
+7
-7
IState.Succeeded.cs
src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs
+1
-1
StateData.cs
src/DotNetCore.CAP/StateData.cs
+0
-13
No files found.
src/DotNetCore.CAP.MySql/CapPublisher.cs
View file @
bfd9ea4e
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.MySql
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.MySql
{
{
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
{
{
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
...
...
src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs
View file @
bfd9ea4e
...
@@ -9,7 +9,6 @@ namespace DotNetCore.CAP.MySql
...
@@ -9,7 +9,6 @@ namespace DotNetCore.CAP.MySql
{
{
internal
class
DefaultAdditionalProcessor
:
IAdditionalProcessor
internal
class
DefaultAdditionalProcessor
:
IAdditionalProcessor
{
{
private
readonly
IServiceProvider
_provider
;
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
MySqlOptions
_options
;
private
readonly
MySqlOptions
_options
;
...
@@ -17,13 +16,10 @@ namespace DotNetCore.CAP.MySql
...
@@ -17,13 +16,10 @@ namespace DotNetCore.CAP.MySql
private
readonly
TimeSpan
_delay
=
TimeSpan
.
FromSeconds
(
1
);
private
readonly
TimeSpan
_delay
=
TimeSpan
.
FromSeconds
(
1
);
private
readonly
TimeSpan
_waitingInterval
=
TimeSpan
.
FromMinutes
(
5
);
private
readonly
TimeSpan
_waitingInterval
=
TimeSpan
.
FromMinutes
(
5
);
public
DefaultAdditionalProcessor
(
public
DefaultAdditionalProcessor
(
ILogger
<
DefaultAdditionalProcessor
>
logger
,
IServiceProvider
provider
,
ILogger
<
DefaultAdditionalProcessor
>
logger
,
MySqlOptions
mysqlOptions
)
MySqlOptions
mysqlOptions
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_provider
=
provider
;
_options
=
mysqlOptions
;
_options
=
mysqlOptions
;
}
}
...
@@ -31,14 +27,14 @@ namespace DotNetCore.CAP.MySql
...
@@ -31,14 +27,14 @@ namespace DotNetCore.CAP.MySql
{
{
_logger
.
LogDebug
(
"Collecting expired entities."
);
_logger
.
LogDebug
(
"Collecting expired entities."
);
var
tables
=
new
string
[]{
var
tables
=
new
[]{
$"
{
_options
.
TableNamePrefix
}
.published"
,
$"
{
_options
.
TableNamePrefix
}
.published"
,
$"
{
_options
.
TableNamePrefix
}
.received"
$"
{
_options
.
TableNamePrefix
}
.received"
};
};
foreach
(
var
table
in
tables
)
foreach
(
var
table
in
tables
)
{
{
var
removedCount
=
0
;
int
removedCount
;
do
do
{
{
using
(
var
connection
=
new
MySqlConnection
(
_options
.
ConnectionString
))
using
(
var
connection
=
new
MySqlConnection
(
_options
.
ConnectionString
))
...
...
src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs
View file @
bfd9ea4e
...
@@ -129,7 +129,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -129,7 +129,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
var
connection
=
new
MySqlConnection
(
_options
.
ConnectionString
);
var
connection
=
new
MySqlConnection
(
_options
.
ConnectionString
);
await
connection
.
OpenAsync
();
await
connection
.
OpenAsync
();
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
FetchedMessage
fetchedMessage
=
null
;
FetchedMessage
fetchedMessage
;
try
try
{
{
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
...
...
src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs
View file @
bfd9ea4e
...
@@ -7,7 +7,7 @@ using MySql.Data.MySqlClient;
...
@@ -7,7 +7,7 @@ using MySql.Data.MySqlClient;
namespace
DotNetCore.CAP.MySql
namespace
DotNetCore.CAP.MySql
{
{
public
class
MySqlStorageTransaction
:
IStorageTransaction
,
IDisposable
public
class
MySqlStorageTransaction
:
IStorageTransaction
{
{
private
readonly
string
_prefix
;
private
readonly
string
_prefix
;
...
...
src/DotNetCore.CAP.PostgreSql/CapPublisher.cs
View file @
bfd9ea4e
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.PostgreSql
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.PostgreSql
{
{
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
{
{
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
...
...
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs
View file @
bfd9ea4e
...
@@ -2,7 +2,6 @@ using System.Threading;
...
@@ -2,7 +2,6 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Dapper
;
using
Dapper
;
using
DotNetCore.CAP.Dashboard
;
using
DotNetCore.CAP.Dashboard
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Npgsql
;
using
Npgsql
;
...
...
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
View file @
bfd9ea4e
...
@@ -113,7 +113,7 @@ namespace DotNetCore.CAP.PostgreSql
...
@@ -113,7 +113,7 @@ namespace DotNetCore.CAP.PostgreSql
var
connection
=
new
NpgsqlConnection
(
_options
.
ConnectionString
);
var
connection
=
new
NpgsqlConnection
(
_options
.
ConnectionString
);
await
connection
.
OpenAsync
();
await
connection
.
OpenAsync
();
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
FetchedMessage
fetchedMessage
=
null
;
FetchedMessage
fetchedMessage
;
try
try
{
{
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
...
...
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs
View file @
bfd9ea4e
...
@@ -7,7 +7,7 @@ using Npgsql;
...
@@ -7,7 +7,7 @@ using Npgsql;
namespace
DotNetCore.CAP.PostgreSql
namespace
DotNetCore.CAP.PostgreSql
{
{
public
class
PostgreSqlStorageTransaction
:
IStorageTransaction
,
IDisposable
public
class
PostgreSqlStorageTransaction
:
IStorageTransaction
{
{
private
readonly
string
_schema
;
private
readonly
string
_schema
;
...
...
src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs
View file @
bfd9ea4e
using
System
;
// ReSharper disable once CheckNamespace
// ReSharper disable once CheckNamespace
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
public
class
RabbitMQOptions
public
class
RabbitMQOptions
...
...
src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs
View file @
bfd9ea4e
using
System
;
using
RabbitMQ.Client
;
using
System.Collections.Generic
;
using
System.Text
;
using
RabbitMQ.Client
;
namespace
DotNetCore.CAP.RabbitMQ
namespace
DotNetCore.CAP.RabbitMQ
{
{
...
...
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs
View file @
bfd9ea4e
...
@@ -13,8 +13,8 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -13,8 +13,8 @@ namespace DotNetCore.CAP.RabbitMQ
private
readonly
string
_exchageName
;
private
readonly
string
_exchageName
;
private
readonly
string
_queueName
;
private
readonly
string
_queueName
;
private
readonly
RabbitMQOptions
_rabbitMQOptions
;
private
readonly
RabbitMQOptions
_rabbitMQOptions
;
private
readonly
ConnectionPool
_connectionPool
;
private
ConnectionPool
_connectionPool
;
private
IModel
_channel
;
private
IModel
_channel
;
private
ulong
_deliveryTag
;
private
ulong
_deliveryTag
;
...
@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.RabbitMQ
type
:
RabbitMQOptions
.
ExchangeType
,
type
:
RabbitMQOptions
.
ExchangeType
,
durable
:
true
);
durable
:
true
);
var
arguments
=
new
Dictionary
<
string
,
object
>
{
{
"x-message-ttl"
,
(
int
)
_rabbitMQOptions
.
QueueMessageExpires
}
};
var
arguments
=
new
Dictionary
<
string
,
object
>
{
{
"x-message-ttl"
,
_rabbitMQOptions
.
QueueMessageExpires
}
};
_channel
.
QueueDeclare
(
_queueName
,
_channel
.
QueueDeclare
(
_queueName
,
durable
:
true
,
durable
:
true
,
exclusive
:
false
,
exclusive
:
false
,
...
...
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs
View file @
bfd9ea4e
using
Microsoft.Extensions.Options
;
namespace
DotNetCore.CAP.RabbitMQ
using
RabbitMQ.Client
;
namespace
DotNetCore.CAP.RabbitMQ
{
{
internal
sealed
class
RabbitMQConsumerClientFactory
:
IConsumerClientFactory
internal
sealed
class
RabbitMQConsumerClientFactory
:
IConsumerClientFactory
{
{
...
...
src/DotNetCore.CAP.SqlServer/CapPublisher.cs
View file @
bfd9ea4e
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.SqlServer
...
@@ -52,14 +52,14 @@ namespace DotNetCore.CAP.SqlServer
{
{
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
dbConnection
.
Execute
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
protected
override
async
Task
ExecuteAsync
(
IDbConnection
dbConnection
,
IDbTransaction
dbTransaction
,
CapPublishedMessage
message
)
{
{
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
await
dbConnection
.
ExecuteAsync
(
PrepareSql
(),
message
,
dbTransaction
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
.
ToString
()
);
_logger
.
LogInformation
(
"Published Message has been persisted in the database. name:"
+
message
);
}
}
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
public
async
Task
PublishAsync
(
CapPublishedMessage
message
)
...
...
src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs
View file @
bfd9ea4e
...
@@ -9,7 +9,6 @@ namespace DotNetCore.CAP.SqlServer
...
@@ -9,7 +9,6 @@ namespace DotNetCore.CAP.SqlServer
{
{
public
class
DefaultAdditionalProcessor
:
IAdditionalProcessor
public
class
DefaultAdditionalProcessor
:
IAdditionalProcessor
{
{
private
readonly
IServiceProvider
_provider
;
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
SqlServerOptions
_options
;
private
readonly
SqlServerOptions
_options
;
...
@@ -22,13 +21,10 @@ namespace DotNetCore.CAP.SqlServer
...
@@ -22,13 +21,10 @@ namespace DotNetCore.CAP.SqlServer
"Published"
,
"Received"
"Published"
,
"Received"
};
};
public
DefaultAdditionalProcessor
(
public
DefaultAdditionalProcessor
(
ILogger
<
DefaultAdditionalProcessor
>
logger
,
IServiceProvider
provider
,
ILogger
<
DefaultAdditionalProcessor
>
logger
,
SqlServerOptions
sqlServerOptions
)
SqlServerOptions
sqlServerOptions
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_provider
=
provider
;
_options
=
sqlServerOptions
;
_options
=
sqlServerOptions
;
}
}
...
@@ -38,7 +34,7 @@ namespace DotNetCore.CAP.SqlServer
...
@@ -38,7 +34,7 @@ namespace DotNetCore.CAP.SqlServer
foreach
(
var
table
in
Tables
)
foreach
(
var
table
in
Tables
)
{
{
var
removedCount
=
0
;
int
removedCount
;
do
do
{
{
using
(
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
))
using
(
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
))
...
...
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
View file @
bfd9ea4e
...
@@ -18,11 +18,8 @@ namespace DotNetCore.CAP.SqlServer
...
@@ -18,11 +18,8 @@ namespace DotNetCore.CAP.SqlServer
public
SqlServerMonitoringApi
(
IStorage
storage
,
SqlServerOptions
options
)
public
SqlServerMonitoringApi
(
IStorage
storage
,
SqlServerOptions
options
)
{
{
if
(
storage
==
null
)
throw
new
ArgumentNullException
(
nameof
(
storage
));
_options
=
options
??
throw
new
ArgumentNullException
(
nameof
(
options
));
if
(
options
==
null
)
throw
new
ArgumentNullException
(
nameof
(
options
));
_storage
=
storage
as
SqlServerStorage
??
throw
new
ArgumentNullException
(
nameof
(
storage
));
_options
=
options
;
_storage
=
storage
as
SqlServerStorage
;
}
}
...
@@ -74,7 +71,7 @@ _options.Schema);
...
@@ -74,7 +71,7 @@ _options.Schema);
public
IList
<
MessageDto
>
Messages
(
MessageQueryDto
queryDto
)
public
IList
<
MessageDto
>
Messages
(
MessageQueryDto
queryDto
)
{
{
var
tableName
=
queryDto
.
MessageType
==
M
odels
.
M
essageType
.
Publish
?
"Published"
:
"Received"
;
var
tableName
=
queryDto
.
MessageType
==
MessageType
.
Publish
?
"Published"
:
"Received"
;
var
where
=
string
.
Empty
;
var
where
=
string
.
Empty
;
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
StatusName
))
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
StatusName
))
{
{
...
@@ -95,9 +92,7 @@ _options.Schema);
...
@@ -95,9 +92,7 @@ _options.Schema);
var
sqlQuery
=
$"select * from [
{
_options
.
Schema
}
].
{
tableName
}
where 1=1
{
where
}
order by Added desc offset @Offset rows fetch next @Limit rows only"
;
var
sqlQuery
=
$"select * from [
{
_options
.
Schema
}
].
{
tableName
}
where 1=1
{
where
}
order by Added desc offset @Offset rows fetch next @Limit rows only"
;
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
conn
.
Query
<
MessageDto
>(
sqlQuery
,
new
{
return
conn
.
Query
<
MessageDto
>(
sqlQuery
,
new
{
{
StatusName
=
queryDto
.
StatusName
,
StatusName
=
queryDto
.
StatusName
,
Group
=
queryDto
.
Group
,
Group
=
queryDto
.
Group
,
...
@@ -105,56 +100,37 @@ _options.Schema);
...
@@ -105,56 +100,37 @@ _options.Schema);
Content
=
queryDto
.
Content
,
Content
=
queryDto
.
Content
,
Offset
=
queryDto
.
CurrentPage
*
queryDto
.
PageSize
,
Offset
=
queryDto
.
CurrentPage
*
queryDto
.
PageSize
,
Limit
=
queryDto
.
PageSize
,
Limit
=
queryDto
.
PageSize
,
}).
ToList
();
}).
ToList
());
});
}
}
public
int
PublishedFailedCount
()
public
int
PublishedFailedCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Failed
));
{
return
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Failed
);
});
}
}
public
int
PublishedProcessingCount
()
public
int
PublishedProcessingCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Processing
));
{
return
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Processing
);
});
}
}
public
int
PublishedSucceededCount
()
public
int
PublishedSucceededCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Succeeded
));
{
return
GetNumberOfMessage
(
conn
,
"Published"
,
StatusName
.
Succeeded
);
});
}
}
public
int
ReceivedFailedCount
()
public
int
ReceivedFailedCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Failed
));
{
return
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Failed
);
});
}
}
public
int
ReceivedProcessingCount
()
public
int
ReceivedProcessingCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Processing
));
{
return
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Processing
);
});
}
}
public
int
ReceivedSucceededCount
()
public
int
ReceivedSucceededCount
()
{
{
return
UseConnection
(
conn
=>
return
UseConnection
(
conn
=>
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Succeeded
));
{
return
GetNumberOfMessage
(
conn
,
"Received"
,
StatusName
.
Succeeded
);
});
}
}
private
int
GetNumberOfMessage
(
IDbConnection
connection
,
string
tableName
,
string
statusName
)
private
int
GetNumberOfMessage
(
IDbConnection
connection
,
string
tableName
,
string
statusName
)
...
...
src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs
View file @
bfd9ea4e
...
@@ -139,7 +139,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -139,7 +139,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
);
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
);
await
connection
.
OpenAsync
();
await
connection
.
OpenAsync
();
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
var
transaction
=
connection
.
BeginTransaction
(
IsolationLevel
.
ReadCommitted
);
FetchedMessage
fetchedMessage
=
null
;
FetchedMessage
fetchedMessage
;
try
try
{
{
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
fetchedMessage
=
await
connection
.
QueryFirstOrDefaultAsync
<
FetchedMessage
>(
sql
,
args
,
transaction
);
...
...
src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs
View file @
bfd9ea4e
...
@@ -7,7 +7,7 @@ using DotNetCore.CAP.Models;
...
@@ -7,7 +7,7 @@ using DotNetCore.CAP.Models;
namespace
DotNetCore.CAP.SqlServer
namespace
DotNetCore.CAP.SqlServer
{
{
public
class
SqlServerStorageTransaction
:
IStorageTransaction
,
IDisposable
public
class
SqlServerStorageTransaction
:
IStorageTransaction
{
{
private
readonly
string
_schema
;
private
readonly
string
_schema
;
...
...
src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs
View file @
bfd9ea4e
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
namespace
DotNetCore.CAP.Abstractions
namespace
DotNetCore.CAP.Abstractions
{
{
...
@@ -10,7 +9,6 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -10,7 +9,6 @@ namespace DotNetCore.CAP.Abstractions
{
{
/// <summary>
/// <summary>
/// Selects a set of <see cref="ConsumerExecutorDescriptor"/> candidates for the current message associated with
/// Selects a set of <see cref="ConsumerExecutorDescriptor"/> candidates for the current message associated with
/// <paramref name="provider"/>.
/// </summary>
/// </summary>
/// <returns>A set of <see cref="ConsumerExecutorDescriptor"/> candidates or <c>null</c>.</returns>
/// <returns>A set of <see cref="ConsumerExecutorDescriptor"/> candidates or <c>null</c>.</returns>
IReadOnlyList
<
ConsumerExecutorDescriptor
>
SelectCandidates
();
IReadOnlyList
<
ConsumerExecutorDescriptor
>
SelectCandidates
();
...
...
src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs
View file @
bfd9ea4e
...
@@ -77,7 +77,7 @@ namespace DotNetCore.CAP.Abstractions.ModelBinding
...
@@ -77,7 +77,7 @@ namespace DotNetCore.CAP.Abstractions.ModelBinding
{
{
return
return
IsSuccess
==
other
.
IsSuccess
&&
IsSuccess
==
other
.
IsSuccess
&&
object
.
Equals
(
Model
,
other
.
Model
);
Equals
(
Model
,
other
.
Model
);
}
}
/// <summary>
/// <summary>
...
...
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
View file @
bfd9ea4e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
DotNetCore.CAP.Abstractions
namespace
DotNetCore.CAP.Abstractions
{
{
/// <inheritdoc />
/// <summary>
/// <summary>
/// An abstract attribute that for kafka attribute or rabbitmq attribute
/// An abstract attribute that for kafka attribute or rabbitmq attribute
/// </summary>
/// </summary>
...
@@ -23,10 +24,5 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -23,10 +24,5 @@ namespace DotNetCore.CAP.Abstractions
/// rabbitmq --> queue.name
/// rabbitmq --> queue.name
/// </summary>
/// </summary>
public
string
Group
{
get
;
set
;
}
=
"cap.default.group"
;
public
string
Group
{
get
;
set
;
}
=
"cap.default.group"
;
/// <summary>
/// unused now
/// </summary>
public
bool
IsOneWay
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs
View file @
bfd9ea4e
...
@@ -3,6 +3,7 @@ using DotNetCore.CAP;
...
@@ -3,6 +3,7 @@ using DotNetCore.CAP;
using
DotNetCore.CAP.Dashboard.GatewayProxy
;
using
DotNetCore.CAP.Dashboard.GatewayProxy
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
// ReSharper disable once CheckNamespace
namespace
Microsoft.AspNetCore.Builder
namespace
Microsoft.AspNetCore.Builder
{
{
/// <summary>
/// <summary>
...
@@ -52,7 +53,7 @@ namespace Microsoft.AspNetCore.Builder
...
@@ -52,7 +53,7 @@ namespace Microsoft.AspNetCore.Builder
var
marker
=
app
.
ApplicationServices
.
GetService
<
CapMarkerService
>();
var
marker
=
app
.
ApplicationServices
.
GetService
<
CapMarkerService
>();
if
(
marker
==
null
)
if
(
marker
==
null
)
{
{
throw
new
InvalidOperationException
(
"AddCap must be called on the service collection. eg: services.AddCap(...)"
);
throw
new
InvalidOperationException
(
"AddCap
()
must be called on the service collection. eg: services.AddCap(...)"
);
}
}
var
messageQueuemarker
=
app
.
ApplicationServices
.
GetService
<
CapMessageQueueMakerService
>();
var
messageQueuemarker
=
app
.
ApplicationServices
.
GetService
<
CapMessageQueueMakerService
>();
...
...
src/DotNetCore.CAP/CAP.Builder.cs
View file @
bfd9ea4e
...
@@ -39,7 +39,7 @@ namespace DotNetCore.CAP
...
@@ -39,7 +39,7 @@ namespace DotNetCore.CAP
/// <summary>
/// <summary>
/// Gets the <see cref="IServiceCollection"/> where MVC services are configured.
/// Gets the <see cref="IServiceCollection"/> where MVC services are configured.
/// </summary>
/// </summary>
public
IServiceCollection
Services
{
get
;
private
set
;
}
public
IServiceCollection
Services
{
get
;
}
/// <summary>
/// <summary>
/// Adds a scoped service of the type specified in serviceType with an implementation
/// Adds a scoped service of the type specified in serviceType with an implementation
...
...
src/DotNetCore.CAP/CAP.Options.cs
View file @
bfd9ea4e
...
@@ -8,7 +8,7 @@ namespace DotNetCore.CAP
...
@@ -8,7 +8,7 @@ namespace DotNetCore.CAP
/// </summary>
/// </summary>
public
class
CapOptions
public
class
CapOptions
{
{
internal
IList
<
ICapOptionsExtension
>
Extensions
{
get
;
private
set
;
}
internal
IList
<
ICapOptionsExtension
>
Extensions
{
get
;
}
/// <summary>
/// <summary>
/// Default value for polling delay timeout, in seconds.
/// Default value for polling delay timeout, in seconds.
...
...
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
View file @
bfd9ea4e
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Reflection
;
using
DotNetCore.CAP
;
using
DotNetCore.CAP
;
using
DotNetCore.CAP.Abstractions
;
using
DotNetCore.CAP.Abstractions
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Internal
;
using
DotNetCore.CAP.Internal
;
using
DotNetCore.CAP.Processor
;
using
DotNetCore.CAP.Processor
;
using
DotNetCore.CAP.Processor.States
;
using
DotNetCore.CAP.Processor.States
;
using
Microsoft.Extensions.DependencyInjection.Extensions
;
using
Microsoft.Extensions.DependencyInjection.Extensions
;
// ReSharper disable once CheckNamespace
namespace
Microsoft.Extensions.DependencyInjection
namespace
Microsoft.Extensions.DependencyInjection
{
{
/// <summary>
/// <summary>
...
...
src/DotNetCore.CAP/CapCache.cs
View file @
bfd9ea4e
...
@@ -19,9 +19,9 @@ namespace DotNetCore.CAP
...
@@ -19,9 +19,9 @@ namespace DotNetCore.CAP
/// </summary>
/// </summary>
public
Cache
()
{
}
public
Cache
()
{
}
private
Dictionary
<
K
,
T
>
cache
=
new
Dictionary
<
K
,
T
>();
private
Dictionary
<
K
,
T
>
_
cache
=
new
Dictionary
<
K
,
T
>();
private
Dictionary
<
K
,
Timer
>
timers
=
new
Dictionary
<
K
,
Timer
>();
private
Dictionary
<
K
,
Timer
>
_
timers
=
new
Dictionary
<
K
,
Timer
>();
private
ReaderWriterLockSlim
locker
=
new
ReaderWriterLockSlim
();
private
ReaderWriterLockSlim
_
locker
=
new
ReaderWriterLockSlim
();
#
endregion
#
endregion
#
region
IDisposable
implementation
&
Clear
#
region
IDisposable
implementation
&
Clear
...
@@ -51,7 +51,7 @@ namespace DotNetCore.CAP
...
@@ -51,7 +51,7 @@ namespace DotNetCore.CAP
{
{
// Dispose managed resources.
// Dispose managed resources.
Clear
();
Clear
();
locker
.
Dispose
();
_
locker
.
Dispose
();
}
}
// Dispose unmanaged resources
// Dispose unmanaged resources
}
}
...
@@ -62,21 +62,21 @@ namespace DotNetCore.CAP
...
@@ -62,21 +62,21 @@ namespace DotNetCore.CAP
/// </summary>
/// </summary>
public
void
Clear
()
public
void
Clear
()
{
{
locker
.
EnterWriteLock
();
_
locker
.
EnterWriteLock
();
try
try
{
{
try
try
{
{
foreach
(
Timer
t
in
timers
.
Values
)
foreach
(
Timer
t
in
_
timers
.
Values
)
t
.
Dispose
();
t
.
Dispose
();
}
}
catch
catch
{
}
{
}
timers
.
Clear
();
_
timers
.
Clear
();
cache
.
Clear
();
_
cache
.
Clear
();
}
}
finally
{
locker
.
ExitWriteLock
();
}
finally
{
_
locker
.
ExitWriteLock
();
}
}
}
#
endregion
#
endregion
...
@@ -86,22 +86,22 @@ namespace DotNetCore.CAP
...
@@ -86,22 +86,22 @@ namespace DotNetCore.CAP
{
{
Timer
timer
;
Timer
timer
;
if
(
timers
.
TryGetValue
(
key
,
out
timer
))
if
(
_
timers
.
TryGetValue
(
key
,
out
timer
))
{
{
if
(
restartTimerIfExists
)
if
(
restartTimerIfExists
)
{
{
timer
.
Change
(
timer
.
Change
(
(
cacheTimeout
==
null
?
Timeout
.
InfiniteTimeSpan
:
cacheTimeout
.
Value
)
,
cacheTimeout
??
Timeout
.
InfiniteTimeSpan
,
Timeout
.
InfiniteTimeSpan
);
Timeout
.
InfiniteTimeSpan
);
}
}
}
}
else
else
timers
.
Add
(
_
timers
.
Add
(
key
,
key
,
new
Timer
(
new
Timer
(
new
TimerCallback
(
RemoveByTimer
),
new
TimerCallback
(
RemoveByTimer
),
key
,
key
,
(
cacheTimeout
==
null
?
Timeout
.
InfiniteTimeSpan
:
cacheTimeout
.
Value
)
,
cacheTimeout
??
Timeout
.
InfiniteTimeSpan
,
Timeout
.
InfiniteTimeSpan
));
Timeout
.
InfiniteTimeSpan
));
}
}
...
@@ -125,17 +125,17 @@ namespace DotNetCore.CAP
...
@@ -125,17 +125,17 @@ namespace DotNetCore.CAP
{
{
if
(
disposed
)
return
;
if
(
disposed
)
return
;
locker
.
EnterWriteLock
();
_
locker
.
EnterWriteLock
();
try
try
{
{
CheckTimer
(
key
,
cacheTimeout
,
restartTimerIfExists
);
CheckTimer
(
key
,
cacheTimeout
,
restartTimerIfExists
);
if
(!
cache
.
ContainsKey
(
key
))
if
(!
_
cache
.
ContainsKey
(
key
))
cache
.
Add
(
key
,
cacheObject
);
_
cache
.
Add
(
key
,
cacheObject
);
else
else
cache
[
key
]
=
cacheObject
;
_
cache
[
key
]
=
cacheObject
;
}
}
finally
{
locker
.
ExitWriteLock
();
}
finally
{
_
locker
.
ExitWriteLock
();
}
}
}
/// <summary>
/// <summary>
...
@@ -164,13 +164,13 @@ namespace DotNetCore.CAP
...
@@ -164,13 +164,13 @@ namespace DotNetCore.CAP
{
{
if
(
disposed
)
return
default
(
T
);
if
(
disposed
)
return
default
(
T
);
locker
.
EnterReadLock
();
_
locker
.
EnterReadLock
();
try
try
{
{
T
rv
;
T
rv
;
return
(
cache
.
TryGetValue
(
key
,
out
rv
)
?
rv
:
default
(
T
));
return
(
_
cache
.
TryGetValue
(
key
,
out
rv
)
?
rv
:
default
(
T
));
}
}
finally
{
locker
.
ExitReadLock
();
}
finally
{
_
locker
.
ExitReadLock
();
}
}
}
/// <summary>
/// <summary>
...
@@ -187,12 +187,12 @@ namespace DotNetCore.CAP
...
@@ -187,12 +187,12 @@ namespace DotNetCore.CAP
return
false
;
return
false
;
}
}
locker
.
EnterReadLock
();
_
locker
.
EnterReadLock
();
try
try
{
{
return
cache
.
TryGetValue
(
key
,
out
value
);
return
_
cache
.
TryGetValue
(
key
,
out
value
);
}
}
finally
{
locker
.
ExitReadLock
();
}
finally
{
_
locker
.
ExitReadLock
();
}
}
}
/// <summary>
/// <summary>
...
@@ -203,22 +203,22 @@ namespace DotNetCore.CAP
...
@@ -203,22 +203,22 @@ namespace DotNetCore.CAP
{
{
if
(
disposed
)
return
;
if
(
disposed
)
return
;
locker
.
EnterWriteLock
();
_
locker
.
EnterWriteLock
();
try
try
{
{
var
removers
=
(
from
k
in
cache
.
Keys
.
Cast
<
K
>()
var
removers
=
(
from
k
in
_
cache
.
Keys
.
Cast
<
K
>()
where
keyPattern
(
k
)
where
keyPattern
(
k
)
select
k
).
ToList
();
select
k
).
ToList
();
foreach
(
K
workKey
in
removers
)
foreach
(
K
workKey
in
removers
)
{
{
try
{
timers
[
workKey
].
Dispose
();
}
try
{
_
timers
[
workKey
].
Dispose
();
}
catch
{
}
catch
{
}
timers
.
Remove
(
workKey
);
_
timers
.
Remove
(
workKey
);
cache
.
Remove
(
workKey
);
_
cache
.
Remove
(
workKey
);
}
}
}
}
finally
{
locker
.
ExitWriteLock
();
}
finally
{
_
locker
.
ExitWriteLock
();
}
}
}
/// <summary>
/// <summary>
...
@@ -230,18 +230,18 @@ namespace DotNetCore.CAP
...
@@ -230,18 +230,18 @@ namespace DotNetCore.CAP
{
{
if
(
disposed
)
return
;
if
(
disposed
)
return
;
locker
.
EnterWriteLock
();
_
locker
.
EnterWriteLock
();
try
try
{
{
if
(
cache
.
ContainsKey
(
key
))
if
(
_
cache
.
ContainsKey
(
key
))
{
{
try
{
timers
[
key
].
Dispose
();
}
try
{
_
timers
[
key
].
Dispose
();
}
catch
{
}
catch
{
}
timers
.
Remove
(
key
);
_
timers
.
Remove
(
key
);
cache
.
Remove
(
key
);
_
cache
.
Remove
(
key
);
}
}
}
}
finally
{
locker
.
ExitWriteLock
();
}
finally
{
_
locker
.
ExitWriteLock
();
}
}
}
/// <summary>
/// <summary>
...
@@ -253,12 +253,12 @@ namespace DotNetCore.CAP
...
@@ -253,12 +253,12 @@ namespace DotNetCore.CAP
{
{
if
(
disposed
)
return
false
;
if
(
disposed
)
return
false
;
locker
.
EnterReadLock
();
_
locker
.
EnterReadLock
();
try
try
{
{
return
cache
.
ContainsKey
(
key
);
return
_
cache
.
ContainsKey
(
key
);
}
}
finally
{
locker
.
ExitReadLock
();
}
finally
{
_
locker
.
ExitReadLock
();
}
}
}
#
endregion
#
endregion
}
}
...
...
src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs
View file @
bfd9ea4e
using
System
;
using
System
;
using
System.Linq
;
using
System.Net
;
using
System.Net
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Dashboard
;
using
DotNetCore.CAP.Dashboard
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http
;
// ReSharper disable once CheckNamespace
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
public
class
DashboardMiddleware
public
class
DashboardMiddleware
...
@@ -23,10 +25,8 @@ namespace DotNetCore.CAP
...
@@ -23,10 +25,8 @@ namespace DotNetCore.CAP
public
Task
Invoke
(
HttpContext
context
)
public
Task
Invoke
(
HttpContext
context
)
{
{
PathString
matchedPath
;
if
(
context
.
Request
.
Path
.
StartsWithSegments
(
_options
.
PathMatch
,
PathString
remainingPath
;
out
var
matchedPath
,
out
var
remainingPath
))
if
(
context
.
Request
.
Path
.
StartsWithSegments
(
_options
.
PathMatch
,
out
matchedPath
,
out
remainingPath
))
{
{
// Update the path
// Update the path
var
path
=
context
.
Request
.
Path
;
var
path
=
context
.
Request
.
Path
;
...
@@ -44,9 +44,7 @@ namespace DotNetCore.CAP
...
@@ -44,9 +44,7 @@ namespace DotNetCore.CAP
return
_next
.
Invoke
(
context
);
return
_next
.
Invoke
(
context
);
}
}
foreach
(
var
filter
in
_options
.
Authorization
)
if
(
_options
.
Authorization
.
Any
(
filter
=>
!
filter
.
Authorize
(
dashboardContext
)))
{
if
(!
filter
.
Authorize
(
dashboardContext
))
{
{
var
isAuthenticated
=
context
.
User
?.
Identity
?.
IsAuthenticated
;
var
isAuthenticated
=
context
.
User
?.
Identity
?.
IsAuthenticated
;
...
@@ -56,7 +54,6 @@ namespace DotNetCore.CAP
...
@@ -56,7 +54,6 @@ namespace DotNetCore.CAP
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
}
}
}
dashboardContext
.
UriMatch
=
findResult
.
Item2
;
dashboardContext
.
UriMatch
=
findResult
.
Item2
;
...
...
src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs
View file @
bfd9ea4e
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
DotNetCore.CAP.Dashboard
;
using
DotNetCore.CAP.Dashboard
;
// ReSharper disable once CheckNamespace
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
public
class
DashboardOptions
public
class
DashboardOptions
...
...
src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs
View file @
bfd9ea4e
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
using
D
otNetCore.CAP.D
ashboard
;
using
Dashboard
;
using
D
otNetCore.CAP.D
ashboard.GatewayProxy
;
using
Dashboard.GatewayProxy
;
using
D
otNetCore.CAP.D
ashboard.GatewayProxy.Requester
;
using
Dashboard.GatewayProxy.Requester
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
internal
sealed
class
DashboardOptionsExtension
:
ICapOptionsExtension
internal
sealed
class
DashboardOptionsExtension
:
ICapOptionsExtension
...
@@ -25,8 +25,6 @@ namespace DotNetCore.CAP
...
@@ -25,8 +25,6 @@ namespace DotNetCore.CAP
services
.
AddSingleton
<
IHttpRequester
,
HttpClientHttpRequester
>();
services
.
AddSingleton
<
IHttpRequester
,
HttpClientHttpRequester
>();
services
.
AddSingleton
<
IHttpClientCache
,
MemoryHttpClientCache
>();
services
.
AddSingleton
<
IHttpClientCache
,
MemoryHttpClientCache
>();
services
.
AddSingleton
<
IRequestMapper
,
RequestMapper
>();
services
.
AddSingleton
<
IRequestMapper
,
RequestMapper
>();
//services.AddScoped<IRequestScopedDataRepository, ScopedDataRepository>();
//services.AddScoped<IRequestScopedDataRepository, HttpDataRepository>();
}
}
}
}
}
}
...
...
src/DotNetCore.CAP/Dashboard/Content/css/cap.css
View file @
bfd9ea4e
...
@@ -310,6 +310,7 @@ a:hover .label-hover {
...
@@ -310,6 +310,7 @@ a:hover .label-hover {
padding
:
12px
;
padding
:
12px
;
background-color
:
#fff
;
background-color
:
#fff
;
border
:
1px
solid
#e5e5e5
;
border
:
1px
solid
#e5e5e5
;
-ms-border-radius
:
3px
;
border-radius
:
3px
;
border-radius
:
3px
;
}
}
...
@@ -333,12 +334,14 @@ a:hover .label-hover {
...
@@ -333,12 +334,14 @@ a:hover .label-hover {
.state-card-body
{
.state-card-body
{
padding
:
10px
;
padding
:
10px
;
margin
:
10px
-12px
-12px
-12px
;
margin
:
10px
-12px
-12px
-12px
;
-ms-border-bottom-left-radius
:
3px
;
border-bottom-left-radius
:
3px
;
border-bottom-left-radius
:
3px
;
-ms-border-bottom-right-radius
:
3px
;
border-bottom-right-radius
:
3px
;
border-bottom-right-radius
:
3px
;
background-color
:
#f5f5f5
;
background-color
:
#f5f5f5
;
}
}
.state-card-body
dl
{
.state-card-body
dl
{
margin-top
:
5px
;
margin-top
:
5px
;
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
...
@@ -353,7 +356,7 @@ a:hover .label-hover {
...
@@ -353,7 +356,7 @@ a:hover .label-hover {
.state-card-body
.stack-trace
{
.state-card-body
.stack-trace
{
background-color
:
transparent
;
background-color
:
transparent
;
padding
:
0
20px
;
padding
:
0
20px
;
margin-bottom
:
0
px
;
margin-bottom
:
0
;
}
}
.state-card-body
.exception-type
{
.state-card-body
.exception-type
{
...
@@ -453,6 +456,7 @@ span.metric-default {
...
@@ -453,6 +456,7 @@ span.metric-default {
div
.metric
{
div
.metric
{
border
:
solid
1px
transparent
;
border
:
solid
1px
transparent
;
-ms-border-radius
:
4px
;
border-radius
:
4px
;
border-radius
:
4px
;
-webkit-box-shadow
:
0
1px
1px
rgba
(
0
,
0
,
0
,
.05
);
-webkit-box-shadow
:
0
1px
1px
rgba
(
0
,
0
,
0
,
.05
);
box-shadow
:
0
1px
1px
rgba
(
0
,
0
,
0
,
.05
);
box-shadow
:
0
1px
1px
rgba
(
0
,
0
,
0
,
.05
);
...
@@ -460,7 +464,7 @@ div.metric {
...
@@ -460,7 +464,7 @@ div.metric {
transition
:
color
.1s
ease-out
,
background
.1s
ease-out
,
border
.1s
ease-out
;
transition
:
color
.1s
ease-out
,
background
.1s
ease-out
,
border
.1s
ease-out
;
}
}
div
.metric
.metric-body
{
div
.metric
.metric-body
{
padding
:
15px
15px
0
;
padding
:
15px
15px
0
;
font-size
:
26px
;
font-size
:
26px
;
text-align
:
center
;
text-align
:
center
;
...
...
src/DotNetCore.CAP/Dashboard/Content/js/cap.js
View file @
bfd9ea4e
...
@@ -398,10 +398,10 @@
...
@@ -398,10 +398,10 @@
updateRelativeDates
();
updateRelativeDates
();
setInterval
(
updateRelativeDates
,
30
*
1000
);
setInterval
(
updateRelativeDates
,
30
*
1000
);
$
(
'
*[title]
'
).
tooltip
();
$
(
"
*[title]
"
).
tooltip
();
var
self
=
this
;
var
self
=
this
;
$
(
'
*[data-metric]
'
).
each
(
function
()
{
$
(
"
*[data-metric]
"
).
each
(
function
()
{
var
name
=
$
(
this
).
data
(
'
metric
'
);
var
name
=
$
(
this
).
data
(
'
metric
'
);
self
.
_metrics
.
addElement
(
name
,
this
);
self
.
_metrics
.
addElement
(
name
,
this
);
});
});
...
...
src/DotNetCore.CAP/Dashboard/DashboardResponse.cs
View file @
bfd9ea4e
...
@@ -24,20 +24,19 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -24,20 +24,19 @@ namespace DotNetCore.CAP.Dashboard
public
CapDashboardResponse
(
HttpContext
context
)
public
CapDashboardResponse
(
HttpContext
context
)
{
{
if
(
context
==
null
)
throw
new
ArgumentNullException
(
nameof
(
context
));
_context
=
context
??
throw
new
ArgumentNullException
(
nameof
(
context
));
_context
=
context
;
}
}
public
override
string
ContentType
public
override
string
ContentType
{
{
get
{
return
_context
.
Response
.
ContentType
;
}
get
=>
_context
.
Response
.
ContentType
;
set
{
_context
.
Response
.
ContentType
=
value
;
}
set
=>
_context
.
Response
.
ContentType
=
value
;
}
}
public
override
int
StatusCode
public
override
int
StatusCode
{
{
get
{
return
_context
.
Response
.
StatusCode
;
}
get
=>
_context
.
Response
.
StatusCode
;
set
{
_context
.
Response
.
StatusCode
=
value
;
}
set
=>
_context
.
Response
.
StatusCode
=
value
;
}
}
public
override
Stream
Body
=>
_context
.
Response
.
Body
;
public
override
Stream
Body
=>
_context
.
Response
.
Body
;
...
...
src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs
View file @
bfd9ea4e
...
@@ -125,11 +125,6 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -125,11 +125,6 @@ namespace DotNetCore.CAP.Dashboard
return
$"
{
GetContentFolderNamespace
(
contentFolder
)}
.
{
resourceName
}
"
;
return
$"
{
GetContentFolderNamespace
(
contentFolder
)}
.
{
resourceName
}
"
;
}
}
private
static
EnqueuedState
CreateEnqueuedState
()
{
return
new
EnqueuedState
();
}
private
static
Assembly
GetExecutingAssembly
()
private
static
Assembly
GetExecutingAssembly
()
{
{
return
typeof
(
DashboardRoutes
).
GetTypeInfo
().
Assembly
;
return
typeof
(
DashboardRoutes
).
GetTypeInfo
().
Assembly
;
...
...
src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs
View file @
bfd9ea4e
...
@@ -15,12 +15,16 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -15,12 +15,16 @@ namespace DotNetCore.CAP.Dashboard
Assembly
assembly
,
Assembly
assembly
,
string
resourceName
)
string
resourceName
)
{
{
if
(
contentType
==
null
)
throw
new
ArgumentNullException
(
nameof
(
contentType
));
if
(
assembly
!=
null
)
if
(
assembly
==
null
)
throw
new
ArgumentNullException
(
nameof
(
assembly
));
{
_assembly
=
assembly
;
_assembly
=
assembly
;
_resourceName
=
resourceName
;
_resourceName
=
resourceName
;
_contentType
=
contentType
;
_contentType
=
contentType
??
throw
new
ArgumentNullException
(
nameof
(
contentType
));
}
else
{
throw
new
ArgumentNullException
(
nameof
(
assembly
));
}
}
}
public
Task
Dispatch
(
DashboardContext
context
)
public
Task
Dispatch
(
DashboardContext
context
)
...
...
src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs
View file @
bfd9ea4e
...
@@ -7,6 +7,6 @@
...
@@ -7,6 +7,6 @@
Value
=
value
;
Value
=
value
;
}
}
public
string
Value
{
get
;
private
set
;
}
public
string
Value
{
get
;
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs
View file @
bfd9ea4e
...
@@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
...
@@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
{
{
public
class
GatewayProxyMiddleware
public
class
GatewayProxyMiddleware
{
{
p
rivate
const
string
NODE_COOKIE_NAME
=
"cap.node"
;
p
ublic
const
string
NodeCookieName
=
"cap.node"
;
private
readonly
RequestDelegate
_next
;
private
readonly
RequestDelegate
_next
;
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
...
@@ -45,12 +45,9 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
...
@@ -45,12 +45,9 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
var
request
=
context
.
Request
;
var
request
=
context
.
Request
;
var
pathMatch
=
discoveryOptions
.
MatchPath
;
var
pathMatch
=
discoveryOptions
.
MatchPath
;
var
isCapRequest
=
request
.
Path
.
StartsWithSegments
(
var
isCapRequest
=
request
.
Path
.
StartsWithSegments
(
new
PathString
(
pathMatch
));
new
PathString
(
pathMatch
),
out
PathString
matchedPath
,
out
PathString
remainingPath
);
var
isSwitchNode
=
request
.
Cookies
.
TryGetValue
(
N
ODE_COOKIE_NAME
,
out
string
requestNodeId
);
var
isSwitchNode
=
request
.
Cookies
.
TryGetValue
(
N
odeCookieName
,
out
string
requestNodeId
);
var
isCurrentNode
=
discoveryOptions
.
NodeId
.
ToString
()
==
requestNodeId
;
var
isCurrentNode
=
discoveryOptions
.
NodeId
.
ToString
()
==
requestNodeId
;
if
(!
isCapRequest
||
!
isSwitchNode
||
isCurrentNode
)
if
(!
isCapRequest
||
!
isSwitchNode
||
isCurrentNode
)
...
@@ -80,7 +77,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
...
@@ -80,7 +77,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy
}
}
else
else
{
{
context
.
Response
.
Cookies
.
Delete
(
N
ODE_COOKIE_NAME
);
context
.
Response
.
Cookies
.
Delete
(
N
odeCookieName
);
await
_next
.
Invoke
(
context
);
await
_next
.
Invoke
(
context
);
}
}
}
}
...
...
src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/HttpClientHttpRequester.cs
View file @
bfd9ea4e
...
@@ -31,7 +31,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
...
@@ -31,7 +31,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
catch
(
Exception
exception
)
catch
(
Exception
exception
)
{
{
_logger
.
LogError
(
"Error making http request, exception:"
+
exception
.
Message
);
_logger
.
LogError
(
"Error making http request, exception:"
+
exception
.
Message
);
throw
exception
;
throw
;
}
}
finally
finally
{
{
...
...
src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs
View file @
bfd9ea4e
namespace
DotNetCore.CAP.Dashboard.GatewayProxy.Requester
using
System.Net.Http
;
namespace
DotNetCore.CAP.Dashboard.GatewayProxy.Requester
{
{
public
interface
IHttpClientBuilder
public
interface
IHttpClientBuilder
{
{
...
...
src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs
View file @
bfd9ea4e
...
@@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
...
@@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
public
void
Set
(
string
id
,
IHttpClient
client
,
TimeSpan
expirationTime
)
public
void
Set
(
string
id
,
IHttpClient
client
,
TimeSpan
expirationTime
)
{
{
ConcurrentQueue
<
IHttpClient
>
connectionQueue
;
if
(
_httpClientsCache
.
TryGetValue
(
id
,
out
var
connectionQueue
))
if
(
_httpClientsCache
.
TryGetValue
(
id
,
out
connectionQueue
))
{
{
connectionQueue
.
Enqueue
(
client
);
connectionQueue
.
Enqueue
(
client
);
}
}
...
@@ -24,15 +23,13 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
...
@@ -24,15 +23,13 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
public
bool
Exists
(
string
id
)
public
bool
Exists
(
string
id
)
{
{
ConcurrentQueue
<
IHttpClient
>
connectionQueue
;
return
_httpClientsCache
.
TryGetValue
(
id
,
out
_
);
return
_httpClientsCache
.
TryGetValue
(
id
,
out
connectionQueue
);
}
}
public
IHttpClient
Get
(
string
id
)
public
IHttpClient
Get
(
string
id
)
{
{
IHttpClient
client
=
null
;
IHttpClient
client
=
null
;
ConcurrentQueue
<
IHttpClient
>
connectionQueue
;
if
(
_httpClientsCache
.
TryGetValue
(
id
,
out
var
connectionQueue
))
if
(
_httpClientsCache
.
TryGetValue
(
id
,
out
connectionQueue
))
{
{
connectionQueue
.
TryDequeue
(
out
client
);
connectionQueue
.
TryDequeue
(
out
client
);
}
}
...
@@ -41,8 +38,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
...
@@ -41,8 +38,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester
public
void
Remove
(
string
id
)
public
void
Remove
(
string
id
)
{
{
ConcurrentQueue
<
IHttpClient
>
connectionQueue
;
_httpClientsCache
.
TryRemove
(
id
,
out
_
);
_httpClientsCache
.
TryRemove
(
id
,
out
connectionQueue
);
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/HtmlHelper.cs
View file @
bfd9ea4e
...
@@ -19,8 +19,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -19,8 +19,7 @@ namespace DotNetCore.CAP.Dashboard
public
HtmlHelper
(
RazorPage
page
)
public
HtmlHelper
(
RazorPage
page
)
{
{
if
(
page
==
null
)
throw
new
ArgumentNullException
(
nameof
(
page
));
_page
=
page
??
throw
new
ArgumentNullException
(
nameof
(
page
));
_page
=
page
;
}
}
public
NonEscapedString
Breadcrumbs
(
string
title
,
IDictionary
<
string
,
string
>
items
)
public
NonEscapedString
Breadcrumbs
(
string
title
,
IDictionary
<
string
,
string
>
items
)
...
@@ -35,11 +34,8 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -35,11 +34,8 @@ namespace DotNetCore.CAP.Dashboard
{
{
return
SidebarMenu
(
MessagesSidebarMenu
.
PublishedItems
);
return
SidebarMenu
(
MessagesSidebarMenu
.
PublishedItems
);
}
}
else
{
return
SidebarMenu
(
MessagesSidebarMenu
.
ReceivedItems
);
return
SidebarMenu
(
MessagesSidebarMenu
.
ReceivedItems
);
}
}
}
public
NonEscapedString
SidebarMenu
(
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
items
)
public
NonEscapedString
SidebarMenu
(
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
items
)
{
{
...
@@ -198,11 +194,9 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -198,11 +194,9 @@ namespace DotNetCore.CAP.Dashboard
#
region
MethodEscaped
#
region
MethodEscaped
public
NonEscapedString
MethodEscaped
(
MethodInfo
method
)
public
NonEscapedString
MethodEscaped
(
MethodInfo
method
)
{
{
var
outputString
=
string
.
Empty
;
var
@public
=
WrapKeyword
(
"public"
);
var
@public
=
WrapKeyword
(
"public"
);
var
@async
=
string
.
Empty
;
var
@async
=
string
.
Empty
;
var
@return
=
string
.
Empty
;
string
@return
;
var
isAwaitable
=
CoercedAwaitableInfo
.
IsTypeAwaitable
(
method
.
ReturnType
,
out
var
coercedAwaitableInfo
);
var
isAwaitable
=
CoercedAwaitableInfo
.
IsTypeAwaitable
(
method
.
ReturnType
,
out
var
coercedAwaitableInfo
);
if
(
isAwaitable
)
if
(
isAwaitable
)
...
@@ -221,7 +215,6 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -221,7 +215,6 @@ namespace DotNetCore.CAP.Dashboard
string
paramType
=
null
;
string
paramType
=
null
;
string
paramName
=
null
;
string
paramName
=
null
;
string
paramString
=
string
.
Empty
;
var
@params
=
method
.
GetParameters
();
var
@params
=
method
.
GetParameters
();
if
(
@params
.
Length
==
1
)
if
(
@params
.
Length
==
1
)
...
@@ -232,16 +225,9 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -232,16 +225,9 @@ namespace DotNetCore.CAP.Dashboard
paramName
=
firstParam
.
Name
;
paramName
=
firstParam
.
Name
;
}
}
if
(
paramType
==
null
)
var
paramString
=
paramType
==
null
?
"();"
:
$"(
{
paramType
}
{
paramName
}
);"
;
{
paramString
=
"();"
;
}
else
{
paramString
=
$"(
{
paramType
}
{
paramName
}
);"
;
}
outputString
=
@public
+
" "
+
(
string
.
IsNullOrEmpty
(
@async
)
?
""
:
@async
+
" "
)
+
@return
+
" "
+
@name
+
paramString
;
var
outputString
=
@public
+
" "
+
(
string
.
IsNullOrEmpty
(
@async
)
?
""
:
@async
+
" "
)
+
@return
+
" "
+
@name
+
paramString
;
return
new
NonEscapedString
(
outputString
);
return
new
NonEscapedString
(
outputString
);
}
}
...
@@ -261,7 +247,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -261,7 +247,7 @@ namespace DotNetCore.CAP.Dashboard
{
{
return
WrapType
(
type
.
Name
);
return
WrapType
(
type
.
Name
);
}
}
if
(
type
.
IsPrimitive
||
type
.
Equals
(
typeof
(
string
))
||
type
.
Equals
(
typeof
(
decimal
)
))
if
(
type
.
IsPrimitive
||
type
==
typeof
(
string
)
||
type
==
typeof
(
decimal
))
{
{
return
WrapKeyword
(
type
.
Name
.
ToLower
());
return
WrapKeyword
(
type
.
Name
.
ToLower
());
}
}
...
@@ -286,11 +272,6 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -286,11 +272,6 @@ namespace DotNetCore.CAP.Dashboard
return
Span
(
"type"
,
value
);
return
Span
(
"type"
,
value
);
}
}
private
string
WrapString
(
string
value
)
{
return
Span
(
"string"
,
value
);
}
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>"
;
...
...
src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs
View file @
bfd9ea4e
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Processor.States
;
using
DotNetCore.CAP.Processor.States
;
using
Newtonsoft.Json
;
namespace
DotNetCore.CAP.Dashboard
namespace
DotNetCore.CAP.Dashboard
{
{
...
...
src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs
View file @
bfd9ea4e
...
@@ -23,9 +23,6 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -23,9 +23,6 @@ namespace DotNetCore.CAP.Dashboard
public
async
Task
Dispatch
(
DashboardContext
context
)
public
async
Task
Dispatch
(
DashboardContext
context
)
{
{
var
request
=
context
.
Request
;
var
response
=
context
.
Response
;
string
serialized
=
null
;
string
serialized
=
null
;
if
(
_command
!=
null
)
if
(
_command
!=
null
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs
View file @
bfd9ea4e
namespace
DotNetCore.CAP.Dashboard.Pages
namespace
DotNetCore.CAP.Dashboard.Pages
{
{
partial
class
BlockMetric
internal
partial
class
BlockMetric
{
{
public
BlockMetric
(
DashboardMetric
dashboardMetric
)
public
BlockMetric
(
DashboardMetric
dashboardMetric
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs
View file @
bfd9ea4e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
DotNetCore.CAP.Dashboard.Pages
namespace
DotNetCore.CAP.Dashboard.Pages
{
{
partial
class
Breadcrumbs
internal
partial
class
Breadcrumbs
{
{
public
Breadcrumbs
(
string
title
,
IDictionary
<
string
,
string
>
items
)
public
Breadcrumbs
(
string
title
,
IDictionary
<
string
,
string
>
items
)
{
{
...
...
src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs
View file @
bfd9ea4e
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
DotNetCore.CAP.NodeDiscovery
;
using
DotNetCore.CAP.NodeDiscovery
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
namespace
DotNetCore.CAP.Dashboard.Pages
namespace
DotNetCore.CAP.Dashboard.Pages
{
{
partial
class
NodePage
internal
partial
class
NodePage
{
{
private
IList
<
Node
>
_nodes
=
null
;
private
IList
<
Node
>
_nodes
;
private
INodeDiscoveryProvider
_discoveryProvider
;
private
INodeDiscoveryProvider
_discoveryProvider
;
public
NodePage
()
public
NodePage
()
...
...
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs
View file @
bfd9ea4e
...
@@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages
...
@@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages
public
int
GetTotal
(
IMonitoringApi
api
)
public
int
GetTotal
(
IMonitoringApi
api
)
{
{
if
(
String
.
Compare
(
StatusName
,
SucceededState
.
StateName
,
tru
e
)
==
0
)
if
(
string
.
Compare
(
StatusName
,
SucceededState
.
StateName
,
StringComparison
.
OrdinalIgnoreCas
e
)
==
0
)
{
{
return
api
.
PublishedSucceededCount
();
return
api
.
PublishedSucceededCount
();
}
}
else
if
(
String
.
Compare
(
StatusName
,
ProcessingState
.
StateName
,
tru
e
)
==
0
)
if
(
string
.
Compare
(
StatusName
,
ProcessingState
.
StateName
,
StringComparison
.
OrdinalIgnoreCas
e
)
==
0
)
{
{
return
api
.
PublishedProcessingCount
();
return
api
.
PublishedProcessingCount
();
}
}
else
{
return
api
.
PublishedFailedCount
();
return
api
.
PublishedFailedCount
();
}
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs
View file @
bfd9ea4e
...
@@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages
...
@@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages
public
int
GetTotal
(
IMonitoringApi
api
)
public
int
GetTotal
(
IMonitoringApi
api
)
{
{
if
(
String
.
Compare
(
StatusName
,
SucceededState
.
StateName
,
tru
e
)
==
0
)
if
(
string
.
Compare
(
StatusName
,
SucceededState
.
StateName
,
StringComparison
.
OrdinalIgnoreCas
e
)
==
0
)
{
{
return
api
.
ReceivedSucceededCount
();
return
api
.
ReceivedSucceededCount
();
}
}
else
if
(
String
.
Compare
(
StatusName
,
ProcessingState
.
StateName
,
tru
e
)
==
0
)
if
(
string
.
Compare
(
StatusName
,
ProcessingState
.
StateName
,
StringComparison
.
OrdinalIgnoreCas
e
)
==
0
)
{
{
return
api
.
ReceivedProcessingCount
();
return
api
.
ReceivedProcessingCount
();
}
}
else
{
return
api
.
ReceivedFailedCount
();
return
api
.
ReceivedFailedCount
();
}
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs
View file @
bfd9ea4e
...
@@ -3,12 +3,11 @@ using System.Collections.Generic;
...
@@ -3,12 +3,11 @@ using System.Collections.Generic;
namespace
DotNetCore.CAP.Dashboard.Pages
namespace
DotNetCore.CAP.Dashboard.Pages
{
{
partial
class
SidebarMenu
internal
partial
class
SidebarMenu
{
{
public
SidebarMenu
(
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
items
)
public
SidebarMenu
(
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
items
)
{
{
if
(
items
==
null
)
throw
new
ArgumentNullException
(
nameof
(
items
));
Items
=
items
??
throw
new
ArgumentNullException
(
nameof
(
items
));
Items
=
items
;
}
}
public
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
Items
{
get
;
}
public
IEnumerable
<
Func
<
RazorPage
,
MenuItem
>>
Items
{
get
;
}
...
...
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml
View file @
bfd9ea4e
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
{
{
var i = 0;
var i = 0;
var rowCount = subscriber.Value.Count;
var rowCount = subscriber.Value.Count;
@
foreach (var column in subscriber.Value)
foreach (var column in subscriber.Value)
{
{
<tr>
<tr>
@if (i == 0)
@if (i == 0)
...
...
src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs
View file @
bfd9ea4e
...
@@ -44,13 +44,13 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -44,13 +44,13 @@ namespace DotNetCore.CAP.Dashboard
public
static
void
AddJsonResult
(
public
static
void
AddJsonResult
(
this
RouteCollection
routes
,
this
RouteCollection
routes
,
string
pathTemplate
,
string
pathTemplate
,
Func
<
DashboardContext
,
string
>
J
sonfunc
)
Func
<
DashboardContext
,
string
>
j
sonfunc
)
{
{
if
(
routes
==
null
)
throw
new
ArgumentNullException
(
nameof
(
routes
));
if
(
routes
==
null
)
throw
new
ArgumentNullException
(
nameof
(
routes
));
if
(
pathTemplate
==
null
)
throw
new
ArgumentNullException
(
nameof
(
pathTemplate
));
if
(
pathTemplate
==
null
)
throw
new
ArgumentNullException
(
nameof
(
pathTemplate
));
if
(
Jsonfunc
==
null
)
throw
new
ArgumentNullException
(
nameof
(
J
sonfunc
));
if
(
jsonfunc
==
null
)
throw
new
ArgumentNullException
(
nameof
(
j
sonfunc
));
routes
.
Add
(
pathTemplate
,
new
JsonDispatcher
(
J
sonfunc
));
routes
.
Add
(
pathTemplate
,
new
JsonDispatcher
(
j
sonfunc
));
}
}
public
static
void
AddPublishBatchCommand
(
public
static
void
AddPublishBatchCommand
(
...
...
src/DotNetCore.CAP/Dashboard/UrlHelper.cs
View file @
bfd9ea4e
...
@@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard
...
@@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard
public
UrlHelper
(
DashboardContext
context
)
public
UrlHelper
(
DashboardContext
context
)
{
{
if
(
context
==
null
)
throw
new
ArgumentNullException
(
nameof
(
context
));
_context
=
context
??
throw
new
ArgumentNullException
(
nameof
(
context
));
_context
=
context
;
}
}
public
string
To
(
string
relativePath
)
public
string
To
(
string
relativePath
)
...
...
src/DotNetCore.CAP/IBootstrapper.Default.cs
View file @
bfd9ea4e
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
...
@@ -12,7 +11,7 @@ namespace DotNetCore.CAP
...
@@ -12,7 +11,7 @@ namespace DotNetCore.CAP
/// <summary>
/// <summary>
/// Default implement of <see cref="IBootstrapper"/>.
/// Default implement of <see cref="IBootstrapper"/>.
/// </summary>
/// </summary>
public
class
DefaultBootstrapper
:
IBootstrapper
internal
class
DefaultBootstrapper
:
IBootstrapper
{
{
private
readonly
ILogger
<
DefaultBootstrapper
>
_logger
;
private
readonly
ILogger
<
DefaultBootstrapper
>
_logger
;
private
readonly
IApplicationLifetime
_appLifetime
;
private
readonly
IApplicationLifetime
_appLifetime
;
...
...
src/DotNetCore.CAP/IConsumerHandler.Default.cs
View file @
bfd9ea4e
...
@@ -8,20 +8,17 @@ using DotNetCore.CAP.Models;
...
@@ -8,20 +8,17 @@ using DotNetCore.CAP.Models;
using
DotNetCore.CAP.Processor
;
using
DotNetCore.CAP.Processor
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
public
class
ConsumerHandler
:
IConsumerHandler
,
IDisposable
internal
class
ConsumerHandler
:
IConsumerHandler
{
{
private
readonly
IServiceProvider
_serviceProvider
;
private
readonly
IServiceProvider
_serviceProvider
;
private
readonly
IConsumerInvokerFactory
_consumerInvokerFactory
;
private
readonly
IConsumerClientFactory
_consumerClientFactory
;
private
readonly
IConsumerClientFactory
_consumerClientFactory
;
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
CancellationTokenSource
_cts
;
private
readonly
CancellationTokenSource
_cts
;
private
readonly
MethodMatcherCache
_selector
;
private
readonly
MethodMatcherCache
_selector
;
private
readonly
CapOptions
_options
;
private
readonly
TimeSpan
_pollingDelay
=
TimeSpan
.
FromSeconds
(
1
);
private
readonly
TimeSpan
_pollingDelay
=
TimeSpan
.
FromSeconds
(
1
);
...
@@ -30,18 +27,14 @@ namespace DotNetCore.CAP
...
@@ -30,18 +27,14 @@ namespace DotNetCore.CAP
public
ConsumerHandler
(
public
ConsumerHandler
(
IServiceProvider
serviceProvider
,
IServiceProvider
serviceProvider
,
IConsumerInvokerFactory
consumerInvokerFactory
,
IConsumerClientFactory
consumerClientFactory
,
IConsumerClientFactory
consumerClientFactory
,
ILogger
<
ConsumerHandler
>
logger
,
ILogger
<
ConsumerHandler
>
logger
,
MethodMatcherCache
selector
,
MethodMatcherCache
selector
)
IOptions
<
CapOptions
>
options
)
{
{
_selector
=
selector
;
_selector
=
selector
;
_logger
=
logger
;
_logger
=
logger
;
_serviceProvider
=
serviceProvider
;
_serviceProvider
=
serviceProvider
;
_consumerInvokerFactory
=
consumerInvokerFactory
;
_consumerClientFactory
=
consumerClientFactory
;
_consumerClientFactory
=
consumerClientFactory
;
_options
=
options
.
Value
;
_cts
=
new
CancellationTokenSource
();
_cts
=
new
CancellationTokenSource
();
}
}
...
@@ -99,7 +92,8 @@ namespace DotNetCore.CAP
...
@@ -99,7 +92,8 @@ namespace DotNetCore.CAP
using
(
var
scope
=
_serviceProvider
.
CreateScope
())
using
(
var
scope
=
_serviceProvider
.
CreateScope
())
{
{
var
receviedMessage
=
StoreMessage
(
scope
,
message
);
StoreMessage
(
scope
,
message
);
client
.
Commit
();
client
.
Commit
();
}
}
Pulse
();
Pulse
();
...
@@ -111,7 +105,7 @@ namespace DotNetCore.CAP
...
@@ -111,7 +105,7 @@ namespace DotNetCore.CAP
};
};
}
}
private
CapReceivedMessage
StoreMessage
(
IServiceScope
serviceScope
,
MessageContext
messageContext
)
private
static
void
StoreMessage
(
IServiceScope
serviceScope
,
MessageContext
messageContext
)
{
{
var
provider
=
serviceScope
.
ServiceProvider
;
var
provider
=
serviceScope
.
ServiceProvider
;
var
messageStore
=
provider
.
GetRequiredService
<
IStorageConnection
>();
var
messageStore
=
provider
.
GetRequiredService
<
IStorageConnection
>();
...
@@ -120,7 +114,6 @@ namespace DotNetCore.CAP
...
@@ -120,7 +114,6 @@ namespace DotNetCore.CAP
StatusName
=
StatusName
.
Scheduled
,
StatusName
=
StatusName
.
Scheduled
,
};
};
messageStore
.
StoreReceivedMessageAsync
(
receivedMessage
).
GetAwaiter
().
GetResult
();
messageStore
.
StoreReceivedMessageAsync
(
receivedMessage
).
GetAwaiter
().
GetResult
();
return
receivedMessage
;
}
}
public
void
Pulse
()
public
void
Pulse
()
...
...
src/DotNetCore.CAP/IProcessingServer.cs
View file @
bfd9ea4e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <inheritdoc />
/// <summary>
/// <summary>
/// A process thread abstract of job process.
/// A process thread abstract of job process.
/// </summary>
/// </summary>
...
...
src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs
View file @
bfd9ea4e
...
@@ -41,7 +41,7 @@ namespace DotNetCore.CAP
...
@@ -41,7 +41,7 @@ namespace DotNetCore.CAP
var
result
=
await
PublishAsync
(
message
.
Name
,
message
.
Content
);
var
result
=
await
PublishAsync
(
message
.
Name
,
message
.
Content
);
sp
.
Stop
();
sp
.
Stop
();
var
newState
=
default
(
IState
)
;
IState
newState
;
if
(!
result
.
Succeeded
)
if
(!
result
.
Succeeded
)
{
{
var
shouldRetry
=
await
UpdateMessageForRetryAsync
(
message
,
connection
);
var
shouldRetry
=
await
UpdateMessageForRetryAsync
(
message
,
connection
);
...
@@ -78,11 +78,10 @@ namespace DotNetCore.CAP
...
@@ -78,11 +78,10 @@ namespace DotNetCore.CAP
}
}
}
}
private
async
Task
<
bool
>
UpdateMessageForRetryAsync
(
CapPublishedMessage
message
,
IStorageConnection
connection
)
private
static
async
Task
<
bool
>
UpdateMessageForRetryAsync
(
CapPublishedMessage
message
,
IStorageConnection
connection
)
{
{
var
retryBehavior
=
RetryBehavior
.
DefaultRetry
;
var
retryBehavior
=
RetryBehavior
.
DefaultRetry
;
var
now
=
DateTime
.
Now
;
var
retries
=
++
message
.
Retries
;
var
retries
=
++
message
.
Retries
;
if
(
retries
>=
retryBehavior
.
RetryCount
)
if
(
retries
>=
retryBehavior
.
RetryCount
)
{
{
...
...
src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs
View file @
bfd9ea4e
...
@@ -47,7 +47,7 @@ namespace DotNetCore.CAP
...
@@ -47,7 +47,7 @@ namespace DotNetCore.CAP
var
result
=
await
ExecuteSubscribeAsync
(
message
);
var
result
=
await
ExecuteSubscribeAsync
(
message
);
sp
.
Stop
();
sp
.
Stop
();
var
newState
=
default
(
IState
)
;
IState
newState
;
if
(!
result
.
Succeeded
)
if
(!
result
.
Succeeded
)
{
{
var
shouldRetry
=
await
UpdateMessageForRetryAsync
(
message
,
connection
);
var
shouldRetry
=
await
UpdateMessageForRetryAsync
(
message
,
connection
);
...
...
src/DotNetCore.CAP/Infrastructure/Helper.cs
View file @
bfd9ea4e
...
@@ -57,8 +57,7 @@ namespace DotNetCore.CAP.Infrastructure
...
@@ -57,8 +57,7 @@ namespace DotNetCore.CAP.Infrastructure
public
static
DateTime
DeserializeDateTime
(
string
value
)
public
static
DateTime
DeserializeDateTime
(
string
value
)
{
{
long
timestamp
;
if
(
long
.
TryParse
(
value
,
out
var
timestamp
))
if
(
long
.
TryParse
(
value
,
out
timestamp
))
{
{
return
FromTimestamp
(
timestamp
);
return
FromTimestamp
(
timestamp
);
}
}
...
@@ -102,13 +101,13 @@ namespace DotNetCore.CAP.Infrastructure
...
@@ -102,13 +101,13 @@ namespace DotNetCore.CAP.Infrastructure
private
static
bool
IsSimpleType
(
Type
type
)
private
static
bool
IsSimpleType
(
Type
type
)
{
{
return
type
.
GetTypeInfo
().
IsPrimitive
||
return
type
.
GetTypeInfo
().
IsPrimitive
||
type
.
Equals
(
typeof
(
decimal
)
)
||
type
==
typeof
(
decimal
)
||
type
.
Equals
(
typeof
(
string
)
)
||
type
==
typeof
(
string
)
||
type
.
Equals
(
typeof
(
DateTime
)
)
||
type
==
typeof
(
DateTime
)
||
type
.
Equals
(
typeof
(
Guid
)
)
||
type
==
typeof
(
Guid
)
||
type
.
Equals
(
typeof
(
DateTimeOffset
)
)
||
type
==
typeof
(
DateTimeOffset
)
||
type
.
Equals
(
typeof
(
TimeSpan
)
)
||
type
==
typeof
(
TimeSpan
)
||
type
.
Equals
(
typeof
(
Uri
)
);
type
==
typeof
(
Uri
);
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs
View file @
bfd9ea4e
...
@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.Internal
var
jsonConent
=
_consumerContext
.
DeliverMessage
.
Content
;
var
jsonConent
=
_consumerContext
.
DeliverMessage
.
Content
;
var
message
=
serializer
.
DeSerialize
<
CapMessageDto
>(
jsonConent
);
var
message
=
serializer
.
DeSerialize
<
CapMessageDto
>(
jsonConent
);
object
result
=
null
;
object
result
;
if
(
_executor
.
MethodParameters
.
Length
>
0
)
if
(
_executor
.
MethodParameters
.
Length
>
0
)
{
{
result
=
await
ExecuteWithParameterAsync
(
obj
,
message
.
Content
.
ToString
());
result
=
await
ExecuteWithParameterAsync
(
obj
,
message
.
Content
.
ToString
());
...
@@ -68,11 +68,8 @@ namespace DotNetCore.CAP.Internal
...
@@ -68,11 +68,8 @@ namespace DotNetCore.CAP.Internal
{
{
return
await
_executor
.
ExecuteAsync
(
@class
);
return
await
_executor
.
ExecuteAsync
(
@class
);
}
}
else
{
return
_executor
.
Execute
(
@class
);
return
_executor
.
Execute
(
@class
);
}
}
}
private
async
Task
<
object
>
ExecuteWithParameterAsync
(
object
@class
,
string
parameterString
)
private
async
Task
<
object
>
ExecuteWithParameterAsync
(
object
@class
,
string
parameterString
)
{
{
...
@@ -87,16 +84,10 @@ namespace DotNetCore.CAP.Internal
...
@@ -87,16 +84,10 @@ namespace DotNetCore.CAP.Internal
{
{
return
await
_executor
.
ExecuteAsync
(
@class
,
bindResult
.
Model
);
return
await
_executor
.
ExecuteAsync
(
@class
,
bindResult
.
Model
);
}
}
else
{
return
_executor
.
Execute
(
@class
,
bindResult
.
Model
);
return
_executor
.
Execute
(
@class
,
bindResult
.
Model
);
}
}
}
else
{
throw
new
MethodBindException
(
$"Parameters:
{
firstParameter
.
Name
}
bind failed! ParameterString is:
{
parameterString
}
"
);
throw
new
MethodBindException
(
$"Parameters:
{
firstParameter
.
Name
}
bind failed! ParameterString is:
{
parameterString
}
"
);
}
}
}
catch
(
FormatException
ex
)
catch
(
FormatException
ex
)
{
{
_logger
.
ModelBinderFormattingException
(
_executor
.
MethodInfo
?.
Name
,
firstParameter
.
Name
,
parameterString
,
ex
);
_logger
.
ModelBinderFormattingException
(
_executor
.
MethodInfo
?.
Name
,
firstParameter
.
Name
,
parameterString
,
ex
);
...
...
src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs
View file @
bfd9ea4e
...
@@ -8,8 +8,9 @@ using Microsoft.Extensions.DependencyInjection;
...
@@ -8,8 +8,9 @@ using Microsoft.Extensions.DependencyInjection;
namespace
DotNetCore.CAP.Internal
namespace
DotNetCore.CAP.Internal
{
{
/// <inheritdoc />
/// <summary>
/// <summary>
/// A default <see cref="
IConsumerServiceSelector"
/> implementation.
/// A default <see cref="
T:DotNetCore.CAP.Abstractions.IConsumerServiceSelector"
/> implementation.
/// </summary>
/// </summary>
public
class
DefaultConsumerServiceSelector
:
IConsumerServiceSelector
public
class
DefaultConsumerServiceSelector
:
IConsumerServiceSelector
{
{
...
@@ -39,7 +40,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -39,7 +40,7 @@ namespace DotNetCore.CAP.Internal
executorDescriptorList
.
AddRange
(
FindConsumersFromInterfaceTypes
(
_serviceProvider
));
executorDescriptorList
.
AddRange
(
FindConsumersFromInterfaceTypes
(
_serviceProvider
));
executorDescriptorList
.
AddRange
(
FindConsumersFromControllerTypes
(
_serviceProvider
));
executorDescriptorList
.
AddRange
(
FindConsumersFromControllerTypes
());
return
executorDescriptorList
;
return
executorDescriptorList
;
}
}
...
@@ -67,8 +68,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -67,8 +68,7 @@ namespace DotNetCore.CAP.Internal
}
}
}
}
private
static
IEnumerable
<
ConsumerExecutorDescriptor
>
FindConsumersFromControllerTypes
(
private
static
IEnumerable
<
ConsumerExecutorDescriptor
>
FindConsumersFromControllerTypes
()
IServiceProvider
provider
)
{
{
var
executorDescriptorList
=
new
List
<
ConsumerExecutorDescriptor
>();
var
executorDescriptorList
=
new
List
<
ConsumerExecutorDescriptor
>();
...
@@ -91,7 +91,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -91,7 +91,7 @@ namespace DotNetCore.CAP.Internal
{
{
var
topicAttrs
=
method
.
GetCustomAttributes
<
TopicAttribute
>(
true
);
var
topicAttrs
=
method
.
GetCustomAttributes
<
TopicAttribute
>(
true
);
if
(
topicAttrs
.
Count
()
==
0
)
continue
;
if
(
!
topicAttrs
.
Any
()
)
continue
;
foreach
(
var
attr
in
topicAttrs
)
foreach
(
var
attr
in
topicAttrs
)
{
{
...
...
src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs
View file @
bfd9ea4e
...
@@ -73,7 +73,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -73,7 +73,7 @@ namespace DotNetCore.CAP.Internal
// so we capture the inner exception.
// so we capture the inner exception.
exception
=
ExceptionDispatchInfo
.
Capture
(
exception
.
InnerException
).
SourceException
;
exception
=
ExceptionDispatchInfo
.
Capture
(
exception
.
InnerException
).
SourceException
;
}
}
throw
exception
;
throw
;
}
}
}
}
...
...
src/DotNetCore.CAP/Internal/ModelBinderFactory.cs
View file @
bfd9ea4e
...
@@ -88,7 +88,7 @@ namespace DotNetCore.CAP.Internal
...
@@ -88,7 +88,7 @@ namespace DotNetCore.CAP.Internal
public
bool
Equals
(
Key
other
)
public
bool
Equals
(
Key
other
)
{
{
return
_metadata
.
Equals
(
other
.
_metadata
)
&&
object
.
ReferenceEquals
(
_token
,
other
.
_token
);
return
_metadata
.
Equals
(
other
.
_metadata
)
&&
ReferenceEquals
(
_token
,
other
.
_token
);
}
}
public
override
bool
Equals
(
object
obj
)
public
override
bool
Equals
(
object
obj
)
...
...
src/DotNetCore.CAP/LoggerExtensions.cs
View file @
bfd9ea4e
...
@@ -16,11 +16,11 @@ namespace DotNetCore.CAP
...
@@ -16,11 +16,11 @@ namespace DotNetCore.CAP
private
static
readonly
Action
<
ILogger
,
string
,
Exception
>
_receivedMessageRetryExecuting
;
private
static
readonly
Action
<
ILogger
,
string
,
Exception
>
_receivedMessageRetryExecuting
;
private
static
readonly
Action
<
ILogger
,
string
,
string
,
string
,
Exception
>
_modelBinderFormattingException
;
private
static
readonly
Action
<
ILogger
,
string
,
string
,
string
,
Exception
>
_modelBinderFormattingException
;
private
static
Action
<
ILogger
,
Exception
>
_jobFailed
;
private
static
readonly
Action
<
ILogger
,
Exception
>
_jobFailed
;
private
static
Action
<
ILogger
,
Exception
>
_jobFailedWillRetry
;
private
static
readonly
Action
<
ILogger
,
Exception
>
_jobFailedWillRetry
;
private
static
Action
<
ILogger
,
double
,
Exception
>
_jobExecuted
;
private
static
readonly
Action
<
ILogger
,
double
,
Exception
>
_jobExecuted
;
private
static
Action
<
ILogger
,
int
,
Exception
>
_jobRetrying
;
private
static
readonly
Action
<
ILogger
,
int
,
Exception
>
_jobRetrying
;
private
static
Action
<
ILogger
,
string
,
Exception
>
_exceptionOccuredWhileExecutingJob
;
private
static
readonly
Action
<
ILogger
,
string
,
Exception
>
_exceptionOccuredWhileExecutingJob
;
static
LoggerExtensions
()
static
LoggerExtensions
()
{
{
...
...
src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs
View file @
bfd9ea4e
namespace
DotNetCore.CAP
// ReSharper disable once CheckNamespace
namespace
DotNetCore.CAP
{
{
public
class
DiscoveryOptions
public
class
DiscoveryOptions
{
{
...
...
src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs
View file @
bfd9ea4e
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
using
DotNetCore.CAP.
NodeDiscovery
;
using
NodeDiscovery
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
internal
sealed
class
DiscoveryOptionsExtension
:
ICapOptionsExtension
internal
sealed
class
DiscoveryOptionsExtension
:
ICapOptionsExtension
...
...
src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs
View file @
bfd9ea4e
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP.NodeDiscovery
namespace
DotNetCore.CAP.NodeDiscovery
{
{
class
DiscoveryProviderFactory
:
IDiscoveryProviderFactory
internal
class
DiscoveryProviderFactory
:
IDiscoveryProviderFactory
{
{
public
INodeDiscoveryProvider
Create
(
DiscoveryOptions
options
)
public
INodeDiscoveryProvider
Create
(
DiscoveryOptions
options
)
{
{
...
...
src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs
View file @
bfd9ea4e
using
System
;
namespace
DotNetCore.CAP.NodeDiscovery
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP.NodeDiscovery
{
{
interface
IDiscoveryProviderFactory
inter
nal
inter
face
IDiscoveryProviderFactory
{
{
INodeDiscoveryProvider
Create
(
DiscoveryOptions
options
);
INodeDiscoveryProvider
Create
(
DiscoveryOptions
options
);
}
}
...
...
src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs
View file @
bfd9ea4e
...
@@ -39,10 +39,11 @@ namespace DotNetCore.CAP.NodeDiscovery
...
@@ -39,10 +39,11 @@ namespace DotNetCore.CAP.NodeDiscovery
Port
=
x
.
Value
.
Port
,
Port
=
x
.
Value
.
Port
,
Tags
=
string
.
Join
(
", "
,
x
.
Value
.
Tags
)
Tags
=
string
.
Join
(
", "
,
x
.
Value
.
Tags
)
});
});
var
nodeList
=
nodes
.
ToList
();
CapCache
.
Global
.
AddOrUpdate
(
"cap.nodes.count"
,
node
s
.
Count
()
,
TimeSpan
.
FromSeconds
(
30
),
true
);
CapCache
.
Global
.
AddOrUpdate
(
"cap.nodes.count"
,
node
List
.
Count
,
TimeSpan
.
FromSeconds
(
30
),
true
);
return
node
s
.
ToList
()
;
return
node
List
;
}
}
catch
(
Exception
)
{
catch
(
Exception
)
{
return
null
;
return
null
;
...
@@ -57,7 +58,7 @@ namespace DotNetCore.CAP.NodeDiscovery
...
@@ -57,7 +58,7 @@ namespace DotNetCore.CAP.NodeDiscovery
Name
=
_options
.
NodeName
,
Name
=
_options
.
NodeName
,
Address
=
_options
.
CurrentNodeHostName
,
Address
=
_options
.
CurrentNodeHostName
,
Port
=
_options
.
CurrentNodePort
,
Port
=
_options
.
CurrentNodePort
,
Tags
=
new
string
[]
{
"CAP"
,
"Client"
,
"Dashboard"
},
Tags
=
new
[]
{
"CAP"
,
"Client"
,
"Dashboard"
},
Check
=
new
AgentServiceCheck
Check
=
new
AgentServiceCheck
{
{
DeregisterCriticalServiceAfter
=
TimeSpan
.
FromSeconds
(
30
),
DeregisterCriticalServiceAfter
=
TimeSpan
.
FromSeconds
(
30
),
...
...
src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs
View file @
bfd9ea4e
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
DotNetCore.CAP.NodeDiscovery
namespace
DotNetCore.CAP.NodeDiscovery
...
...
src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs
View file @
bfd9ea4e
using
System
;
namespace
DotNetCore.CAP.NodeDiscovery
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP.NodeDiscovery
{
{
class
ConsulProcessingNodeServer
:
IProcessingServer
internal
class
ConsulProcessingNodeServer
:
IProcessingServer
{
{
private
readonly
DiscoveryOptions
dashboardOptions
;
private
readonly
DiscoveryOptions
_
dashboardOptions
;
private
readonly
IDiscoveryProviderFactory
discoveryProviderFactory
;
private
readonly
IDiscoveryProviderFactory
_
discoveryProviderFactory
;
public
ConsulProcessingNodeServer
(
public
ConsulProcessingNodeServer
(
DiscoveryOptions
dashboardOptions
,
DiscoveryOptions
dashboardOptions
,
IDiscoveryProviderFactory
discoveryProviderFactory
)
IDiscoveryProviderFactory
discoveryProviderFactory
)
{
{
this
.
dashboardOptions
=
dashboardOptions
;
_
dashboardOptions
=
dashboardOptions
;
this
.
discoveryProviderFactory
=
discoveryProviderFactory
;
_
discoveryProviderFactory
=
discoveryProviderFactory
;
}
}
public
void
Start
()
public
void
Start
()
{
{
var
discoveryProvider
=
discoveryProviderFactory
.
Create
(
dashboardOptions
);
var
discoveryProvider
=
_discoveryProviderFactory
.
Create
(
_
dashboardOptions
);
discoveryProvider
.
RegisterNode
();
discoveryProvider
.
RegisterNode
();
}
}
...
...
src/DotNetCore.CAP/NodeDiscovery/Node.cs
View file @
bfd9ea4e
using
System
;
namespace
DotNetCore.CAP.NodeDiscovery
using
System.Collections.Generic
;
using
System.Text
;
namespace
DotNetCore.CAP.NodeDiscovery
{
{
public
class
Node
public
class
Node
{
{
...
...
src/DotNetCore.CAP/OperateResult.cs
View file @
bfd9ea4e
...
@@ -51,8 +51,11 @@ namespace DotNetCore.CAP
...
@@ -51,8 +51,11 @@ namespace DotNetCore.CAP
public
static
OperateResult
Failed
(
Exception
ex
,
params
OperateError
[]
errors
)
public
static
OperateResult
Failed
(
Exception
ex
,
params
OperateError
[]
errors
)
{
{
var
result
=
new
OperateResult
{
Succeeded
=
false
};
var
result
=
new
OperateResult
result
.
Exception
=
ex
;
{
Succeeded
=
false
,
Exception
=
ex
};
if
(
errors
!=
null
)
if
(
errors
!=
null
)
{
{
result
.
_errors
.
AddRange
(
errors
);
result
.
_errors
.
AddRange
(
errors
);
...
...
src/DotNetCore.CAP/Processor/IDispatcher.Default.cs
View file @
bfd9ea4e
...
@@ -3,7 +3,6 @@ using System.Threading;
...
@@ -3,7 +3,6 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Infrastructure
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
namespace
DotNetCore.CAP.Processor
namespace
DotNetCore.CAP.Processor
...
@@ -11,24 +10,15 @@ namespace DotNetCore.CAP.Processor
...
@@ -11,24 +10,15 @@ namespace DotNetCore.CAP.Processor
public
class
DefaultDispatcher
:
IDispatcher
public
class
DefaultDispatcher
:
IDispatcher
{
{
private
readonly
IQueueExecutorFactory
_queueExecutorFactory
;
private
readonly
IQueueExecutorFactory
_queueExecutorFactory
;
private
readonly
IServiceProvider
_provider
;
private
readonly
ILogger
_logger
;
private
readonly
CancellationTokenSource
_cts
;
private
readonly
TimeSpan
_pollingDelay
;
private
readonly
TimeSpan
_pollingDelay
;
internal
static
readonly
AutoResetEvent
PulseEvent
=
new
AutoResetEvent
(
true
);
internal
static
readonly
AutoResetEvent
PulseEvent
=
new
AutoResetEvent
(
true
);
public
DefaultDispatcher
(
public
DefaultDispatcher
(
IQueueExecutorFactory
queueExecutorFactory
,
IServiceProvider
provider
,
IOptions
<
CapOptions
>
capOptions
)
IQueueExecutorFactory
queueExecutorFactory
,
IOptions
<
CapOptions
>
capOptions
,
ILogger
<
DefaultDispatcher
>
logger
)
{
{
_logger
=
logger
;
_queueExecutorFactory
=
queueExecutorFactory
;
_queueExecutorFactory
=
queueExecutorFactory
;
_provider
=
provider
;
_cts
=
new
CancellationTokenSource
();
_pollingDelay
=
TimeSpan
.
FromSeconds
(
capOptions
.
Value
.
PollingDelay
);
_pollingDelay
=
TimeSpan
.
FromSeconds
(
capOptions
.
Value
.
PollingDelay
);
}
}
...
@@ -73,7 +63,7 @@ namespace DotNetCore.CAP.Processor
...
@@ -73,7 +63,7 @@ namespace DotNetCore.CAP.Processor
private
async
Task
<
bool
>
Step
(
ProcessingContext
context
)
private
async
Task
<
bool
>
Step
(
ProcessingContext
context
)
{
{
var
fetched
=
default
(
IFetchedMessage
)
;
IFetchedMessage
fetched
;
using
(
var
scopedContext
=
context
.
CreateScope
())
using
(
var
scopedContext
=
context
.
CreateScope
())
{
{
var
provider
=
scopedContext
.
Provider
;
var
provider
=
scopedContext
.
Provider
;
...
...
src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs
View file @
bfd9ea4e
...
@@ -9,16 +9,16 @@ using Microsoft.Extensions.Options;
...
@@ -9,16 +9,16 @@ using Microsoft.Extensions.Options;
namespace
DotNetCore.CAP.Processor
namespace
DotNetCore.CAP.Processor
{
{
public
class
CapProcessingServer
:
IProcessingServer
,
IDisposable
public
class
CapProcessingServer
:
IProcessingServer
{
{
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
ILoggerFactory
_loggerFactory
;
private
readonly
ILoggerFactory
_loggerFactory
;
private
readonly
IServiceProvider
_provider
;
private
readonly
IServiceProvider
_provider
;
private
readonly
CancellationTokenSource
_cts
;
private
readonly
CancellationTokenSource
_cts
;
private
readonly
CapOptions
_options
;
private
readonly
CapOptions
_options
;
private
readonly
IList
<
IDispatcher
>
_messageDispatchers
;
private
IProcessor
[]
_processors
;
private
IProcessor
[]
_processors
;
private
IList
<
IDispatcher
>
_messageDispatchers
;
private
ProcessingContext
_context
;
private
ProcessingContext
_context
;
private
Task
_compositeTask
;
private
Task
_compositeTask
;
private
bool
_disposed
;
private
bool
_disposed
;
...
@@ -109,7 +109,7 @@ namespace DotNetCore.CAP.Processor
...
@@ -109,7 +109,7 @@ namespace DotNetCore.CAP.Processor
private
IProcessor
[]
GetProcessors
(
int
processorCount
)
private
IProcessor
[]
GetProcessors
(
int
processorCount
)
{
{
var
returnedProcessors
=
new
List
<
IProcessor
>();
var
returnedProcessors
=
new
List
<
IProcessor
>();
for
(
int
i
=
0
;
i
<
processorCount
;
i
++)
for
(
var
i
=
0
;
i
<
processorCount
;
i
++)
{
{
var
messageProcessors
=
_provider
.
GetRequiredService
<
IDispatcher
>();
var
messageProcessors
=
_provider
.
GetRequiredService
<
IDispatcher
>();
_messageDispatchers
.
Add
(
messageProcessors
);
_messageDispatchers
.
Add
(
messageProcessors
);
...
...
src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs
View file @
bfd9ea4e
...
@@ -13,7 +13,6 @@ namespace DotNetCore.CAP.Processor
...
@@ -13,7 +13,6 @@ namespace DotNetCore.CAP.Processor
public
class
PublishQueuer
:
IProcessor
public
class
PublishQueuer
:
IProcessor
{
{
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
CapOptions
_options
;
private
readonly
IStateChanger
_stateChanger
;
private
readonly
IStateChanger
_stateChanger
;
private
readonly
IServiceProvider
_provider
;
private
readonly
IServiceProvider
_provider
;
private
readonly
TimeSpan
_pollingDelay
;
private
readonly
TimeSpan
_pollingDelay
;
...
@@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor
...
@@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor
IServiceProvider
provider
)
IServiceProvider
provider
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_options
=
options
.
Value
;
_stateChanger
=
stateChanger
;
_stateChanger
=
stateChanger
;
_provider
=
provider
;
_provider
=
provider
;
_pollingDelay
=
TimeSpan
.
FromSeconds
(
_options
.
PollingDelay
);
var
capOptions
=
options
.
Value
;
_pollingDelay
=
TimeSpan
.
FromSeconds
(
capOptions
.
PollingDelay
);
}
}
public
async
Task
ProcessAsync
(
ProcessingContext
context
)
public
async
Task
ProcessAsync
(
ProcessingContext
context
)
{
{
_logger
.
LogDebug
(
"Publish Queuer start calling."
);
using
(
var
scope
=
_provider
.
CreateScope
())
using
(
var
scope
=
_provider
.
CreateScope
())
{
{
CapPublishedMessage
sentMessage
;
CapPublishedMessage
sentMessage
;
...
...
src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs
View file @
bfd9ea4e
...
@@ -12,11 +12,10 @@ namespace DotNetCore.CAP.Processor
...
@@ -12,11 +12,10 @@ namespace DotNetCore.CAP.Processor
{
{
public
class
SubscribeQueuer
:
IProcessor
public
class
SubscribeQueuer
:
IProcessor
{
{
private
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
CapOptions
_options
;
private
readonly
IStateChanger
_stateChanger
;
private
IStateChanger
_stateChanger
;
private
readonly
IServiceProvider
_provider
;
private
IServiceProvider
_provider
;
private
readonly
TimeSpan
_pollingDelay
;
private
TimeSpan
_pollingDelay
;
internal
static
readonly
AutoResetEvent
PulseEvent
=
new
AutoResetEvent
(
true
);
internal
static
readonly
AutoResetEvent
PulseEvent
=
new
AutoResetEvent
(
true
);
...
@@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor
...
@@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor
IServiceProvider
provider
)
IServiceProvider
provider
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_options
=
options
.
Value
;
_stateChanger
=
stateChanger
;
_stateChanger
=
stateChanger
;
_provider
=
provider
;
_provider
=
provider
;
_pollingDelay
=
TimeSpan
.
FromSeconds
(
_options
.
PollingDelay
);
var
capOptions
=
options
.
Value
;
_pollingDelay
=
TimeSpan
.
FromSeconds
(
capOptions
.
PollingDelay
);
}
}
public
async
Task
ProcessAsync
(
ProcessingContext
context
)
public
async
Task
ProcessAsync
(
ProcessingContext
context
)
{
{
_logger
.
LogDebug
(
"SubscribeQueuer start calling."
);
using
(
var
scope
=
_provider
.
CreateScope
())
using
(
var
scope
=
_provider
.
CreateScope
())
{
{
CapReceivedMessage
message
;
CapReceivedMessage
message
;
...
...
src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs
View file @
bfd9ea4e
...
@@ -7,7 +7,7 @@ namespace DotNetCore.CAP.Processor.States
...
@@ -7,7 +7,7 @@ namespace DotNetCore.CAP.Processor.States
{
{
public
const
string
StateName
=
"Succeeded"
;
public
const
string
StateName
=
"Succeeded"
;
public
TimeSpan
?
ExpiresAfter
{
get
;
private
set
;
}
public
TimeSpan
?
ExpiresAfter
{
get
;
}
public
string
Name
=>
StateName
;
public
string
Name
=>
StateName
;
...
...
src/DotNetCore.CAP/StateData.cs
deleted
100644 → 0
View file @
595adb76
using
System.Collections.Generic
;
namespace
DotNetCore.CAP
{
public
class
StateData
{
public
string
Name
{
get
;
set
;
}
public
string
Reason
{
get
;
set
;
}
public
IDictionary
<
string
,
string
>
Data
{
get
;
set
;
}
}
}
\ No newline at end of file
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