From bfd9ea4ec090c96939bec5a1f54a0034d82b7476 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 27 Sep 2017 22:55:10 +0800 Subject: [PATCH 1/4] cleanup code. --- src/DotNetCore.CAP.MySql/CapPublisher.cs | 4 +- .../IAdditionalProcessor.Default.cs | 10 +-- .../MySqlStorageConnection.cs | 2 +- .../MySqlStorageTransaction.cs | 2 +- src/DotNetCore.CAP.PostgreSql/CapPublisher.cs | 4 +- .../PostgreSqlStorage.cs | 1 - .../PostgreSqlStorageConnection.cs | 2 +- .../PostgreSqlStorageTransaction.cs | 2 +- .../CAP.RabbiMQOptions.cs | 4 +- .../IConnectionPool.cs | 5 +- .../RabbitMQConsumerClient.cs | 4 +- .../RabbitMQConsumerClientFactory.cs | 5 +- src/DotNetCore.CAP.SqlServer/CapPublisher.cs | 4 +- .../IAdditionalProcessor.Default.cs | 8 +- .../SqlServerMonitoringApi.cs | 58 ++++---------- .../SqlServerStorageConnection.cs | 2 +- .../SqlServerStorageTransaction.cs | 2 +- .../Abstractions/IConsumerServiceSelector.cs | 4 +- .../ModelBinding/ModelBindingResult.cs | 2 +- .../Abstractions/TopicAttribute.cs | 6 +- .../CAP.AppBuilderExtensions.cs | 3 +- src/DotNetCore.CAP/CAP.Builder.cs | 2 +- src/DotNetCore.CAP/CAP.Options.cs | 2 +- .../CAP.ServiceCollectionExtensions.cs | 3 +- src/DotNetCore.CAP/CapCache.cs | 78 +++++++++---------- .../Dashboard/CAP.DashboardMiddleware.cs | 23 +++--- .../Dashboard/CAP.DashboardOptions.cs | 5 +- .../CAP.DashboardOptionsExtensions.cs | 8 +- .../Dashboard/Content/css/cap.css | 10 ++- .../Dashboard/Content/js/cap.js | 4 +- .../Dashboard/DashboardResponse.cs | 11 ++- .../Dashboard/DashboardRoutes.cs | 5 -- .../Dashboard/EmbeddedResourceDispatcher.cs | 16 ++-- .../Dashboard/GatewayProxy/DownstreamUrl.cs | 2 +- .../GatewayProxy/GatewayProxyMiddleware.cs | 11 +-- .../Requester/HttpClientHttpRequester.cs | 2 +- .../Requester/IHttpClientBuilder.cs | 4 +- .../Requester/MemoryHttpClientCache.cs | 12 +-- src/DotNetCore.CAP/Dashboard/HtmlHelper.cs | 31 ++------ .../Dashboard/JobHistoryRenderer.cs | 2 - .../Dashboard/JsonDispatcher.cs | 3 - .../Dashboard/Pages/BlockMetric.cs | 2 +- .../Dashboard/Pages/Breadcrumbs.cs | 2 +- .../Dashboard/Pages/NodePage.cs | 7 +- .../Dashboard/Pages/PublishedPage.cs | 9 +-- .../Dashboard/Pages/ReceivedPage.cs | 9 +-- .../Dashboard/Pages/SidebarMenu.cs | 5 +- .../Dashboard/Pages/SubscriberPage.cshtml | 2 +- .../Dashboard/RouteCollectionExtensions.cs | 6 +- src/DotNetCore.CAP/Dashboard/UrlHelper.cs | 3 +- src/DotNetCore.CAP/IBootstrapper.Default.cs | 3 +- .../IConsumerHandler.Default.cs | 17 ++-- src/DotNetCore.CAP/IProcessingServer.cs | 1 + .../IQueueExecutor.Publish.Base.cs | 5 +- src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs | 2 +- src/DotNetCore.CAP/Infrastructure/Helper.cs | 17 ++-- .../Internal/IConsumerInvoker.Default.cs | 17 +--- .../IConsumerServiceSelector.Default.cs | 10 +-- .../Internal/IModelBinder.SimpleType.cs | 2 +- .../Internal/ModelBinderFactory.cs | 2 +- src/DotNetCore.CAP/LoggerExtensions.cs | 10 +-- .../NodeDiscovery/CAP.DiscoveryOptions.cs | 5 +- .../CAP.DiscoveryOptionsExtensions.cs | 4 +- .../IDiscoveryProviderFactory.Default.cs | 4 +- .../IDiscoveryProviderFactory.cs | 8 +- .../INodeDiscoveryProvider.Consul.cs | 7 +- .../NodeDiscovery/INodeDiscoveryProvider.cs | 4 +- .../NodeDiscovery/IProcessingServer.Consul.cs | 18 ++--- src/DotNetCore.CAP/NodeDiscovery/Node.cs | 6 +- src/DotNetCore.CAP/OperateResult.cs | 7 +- .../Processor/IDispatcher.Default.cs | 16 +--- .../Processor/IProcessingServer.Cap.cs | 6 +- .../Processor/IProcessor.PublishQueuer.cs | 6 +- .../Processor/IProcessor.SubscribeQueuer.cs | 14 ++-- .../Processor/States/IState.Succeeded.cs | 2 +- src/DotNetCore.CAP/StateData.cs | 13 ---- 76 files changed, 238 insertions(+), 381 deletions(-) delete mode 100644 src/DotNetCore.CAP/StateData.cs diff --git a/src/DotNetCore.CAP.MySql/CapPublisher.cs b/src/DotNetCore.CAP.MySql/CapPublisher.cs index 0d6a1b3..27adc48 100644 --- a/src/DotNetCore.CAP.MySql/CapPublisher.cs +++ b/src/DotNetCore.CAP.MySql/CapPublisher.cs @@ -52,14 +52,14 @@ namespace DotNetCore.CAP.MySql { 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) { 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) diff --git a/src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs b/src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs index 3398dc0..b21013b 100644 --- a/src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs +++ b/src/DotNetCore.CAP.MySql/IAdditionalProcessor.Default.cs @@ -9,7 +9,6 @@ namespace DotNetCore.CAP.MySql { internal class DefaultAdditionalProcessor : IAdditionalProcessor { - private readonly IServiceProvider _provider; private readonly ILogger _logger; private readonly MySqlOptions _options; @@ -17,13 +16,10 @@ namespace DotNetCore.CAP.MySql private readonly TimeSpan _delay = TimeSpan.FromSeconds(1); private readonly TimeSpan _waitingInterval = TimeSpan.FromMinutes(5); - public DefaultAdditionalProcessor( - IServiceProvider provider, - ILogger logger, + public DefaultAdditionalProcessor(ILogger logger, MySqlOptions mysqlOptions) { _logger = logger; - _provider = provider; _options = mysqlOptions; } @@ -31,14 +27,14 @@ namespace DotNetCore.CAP.MySql { _logger.LogDebug("Collecting expired entities."); - var tables = new string[]{ + var tables = new[]{ $"{_options.TableNamePrefix}.published", $"{_options.TableNamePrefix}.received" }; foreach (var table in tables) { - var removedCount = 0; + int removedCount; do { using (var connection = new MySqlConnection(_options.ConnectionString)) diff --git a/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs b/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs index ae2efac..4d129e9 100644 --- a/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs +++ b/src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs @@ -129,7 +129,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; var connection = new MySqlConnection(_options.ConnectionString); await connection.OpenAsync(); var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted); - FetchedMessage fetchedMessage = null; + FetchedMessage fetchedMessage; try { fetchedMessage = await connection.QueryFirstOrDefaultAsync(sql, args, transaction); diff --git a/src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs b/src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs index d93be89..a769f2a 100644 --- a/src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs +++ b/src/DotNetCore.CAP.MySql/MySqlStorageTransaction.cs @@ -7,7 +7,7 @@ using MySql.Data.MySqlClient; namespace DotNetCore.CAP.MySql { - public class MySqlStorageTransaction : IStorageTransaction, IDisposable + public class MySqlStorageTransaction : IStorageTransaction { private readonly string _prefix; diff --git a/src/DotNetCore.CAP.PostgreSql/CapPublisher.cs b/src/DotNetCore.CAP.PostgreSql/CapPublisher.cs index 0f4e6c9..835e68a 100644 --- a/src/DotNetCore.CAP.PostgreSql/CapPublisher.cs +++ b/src/DotNetCore.CAP.PostgreSql/CapPublisher.cs @@ -52,14 +52,14 @@ namespace DotNetCore.CAP.PostgreSql { 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) { 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) diff --git a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs index 62cc7be..f85fb2d 100644 --- a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs +++ b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorage.cs @@ -2,7 +2,6 @@ using System.Threading; using System.Threading.Tasks; using Dapper; using DotNetCore.CAP.Dashboard; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Npgsql; diff --git a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs index 59286ab..d4e7af7 100644 --- a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs +++ b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs @@ -113,7 +113,7 @@ namespace DotNetCore.CAP.PostgreSql var connection = new NpgsqlConnection(_options.ConnectionString); await connection.OpenAsync(); var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted); - FetchedMessage fetchedMessage = null; + FetchedMessage fetchedMessage; try { fetchedMessage = await connection.QueryFirstOrDefaultAsync(sql, args, transaction); diff --git a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs index ac106d4..c5f1be3 100644 --- a/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs +++ b/src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageTransaction.cs @@ -7,7 +7,7 @@ using Npgsql; namespace DotNetCore.CAP.PostgreSql { - public class PostgreSqlStorageTransaction : IStorageTransaction, IDisposable + public class PostgreSqlStorageTransaction : IStorageTransaction { private readonly string _schema; diff --git a/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs b/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs index b1061d8..6afc0ce 100644 --- a/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs +++ b/src/DotNetCore.CAP.RabbitMQ/CAP.RabbiMQOptions.cs @@ -1,6 +1,4 @@ -using System; - -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace namespace DotNetCore.CAP { public class RabbitMQOptions diff --git a/src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs b/src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs index 9097f28..c916838 100644 --- a/src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs +++ b/src/DotNetCore.CAP.RabbitMQ/IConnectionPool.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using RabbitMQ.Client; +using RabbitMQ.Client; namespace DotNetCore.CAP.RabbitMQ { diff --git a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs index 0172c2b..1465326 100644 --- a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs +++ b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs @@ -13,8 +13,8 @@ namespace DotNetCore.CAP.RabbitMQ private readonly string _exchageName; private readonly string _queueName; private readonly RabbitMQOptions _rabbitMQOptions; + private readonly ConnectionPool _connectionPool; - private ConnectionPool _connectionPool; private IModel _channel; private ulong _deliveryTag; @@ -45,7 +45,7 @@ namespace DotNetCore.CAP.RabbitMQ type: RabbitMQOptions.ExchangeType, durable: true); - var arguments = new Dictionary { { "x-message-ttl", (int)_rabbitMQOptions.QueueMessageExpires } }; + var arguments = new Dictionary { { "x-message-ttl", _rabbitMQOptions.QueueMessageExpires } }; _channel.QueueDeclare(_queueName, durable: true, exclusive: false, diff --git a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs index 753fc05..cf2a1d0 100644 --- a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs +++ b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs @@ -1,7 +1,4 @@ -using Microsoft.Extensions.Options; -using RabbitMQ.Client; - -namespace DotNetCore.CAP.RabbitMQ +namespace DotNetCore.CAP.RabbitMQ { internal sealed class RabbitMQConsumerClientFactory : IConsumerClientFactory { diff --git a/src/DotNetCore.CAP.SqlServer/CapPublisher.cs b/src/DotNetCore.CAP.SqlServer/CapPublisher.cs index 18c17c2..21b2f00 100644 --- a/src/DotNetCore.CAP.SqlServer/CapPublisher.cs +++ b/src/DotNetCore.CAP.SqlServer/CapPublisher.cs @@ -52,14 +52,14 @@ namespace DotNetCore.CAP.SqlServer { 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) { 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) diff --git a/src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs b/src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs index 7c1bac1..f5a1dac 100644 --- a/src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs +++ b/src/DotNetCore.CAP.SqlServer/IAdditionalProcessor.Default.cs @@ -9,7 +9,6 @@ namespace DotNetCore.CAP.SqlServer { public class DefaultAdditionalProcessor : IAdditionalProcessor { - private readonly IServiceProvider _provider; private readonly ILogger _logger; private readonly SqlServerOptions _options; @@ -22,13 +21,10 @@ namespace DotNetCore.CAP.SqlServer "Published","Received" }; - public DefaultAdditionalProcessor( - IServiceProvider provider, - ILogger logger, + public DefaultAdditionalProcessor(ILogger logger, SqlServerOptions sqlServerOptions) { _logger = logger; - _provider = provider; _options = sqlServerOptions; } @@ -38,7 +34,7 @@ namespace DotNetCore.CAP.SqlServer foreach (var table in Tables) { - var removedCount = 0; + int removedCount; do { using (var connection = new SqlConnection(_options.ConnectionString)) diff --git a/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs b/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs index ef74ede..6cfb4e2 100644 --- a/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs +++ b/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs @@ -18,11 +18,8 @@ namespace DotNetCore.CAP.SqlServer public SqlServerMonitoringApi(IStorage storage, SqlServerOptions options) { - if (storage == null) throw new ArgumentNullException(nameof(storage)); - if (options == null) throw new ArgumentNullException(nameof(options)); - - _options = options; - _storage = storage as SqlServerStorage; + _options = options ?? throw new ArgumentNullException(nameof(options)); + _storage = storage as SqlServerStorage ?? throw new ArgumentNullException(nameof(storage)); } @@ -74,7 +71,7 @@ _options.Schema); public IList Messages(MessageQueryDto queryDto) { - var tableName = queryDto.MessageType == Models.MessageType.Publish ? "Published" : "Received"; + var tableName = queryDto.MessageType == MessageType.Publish ? "Published" : "Received"; var where = string.Empty; if (!string.IsNullOrEmpty(queryDto.StatusName)) { @@ -95,66 +92,45 @@ _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"; - return UseConnection(conn => + return UseConnection(conn => conn.Query(sqlQuery, new { - return conn.Query(sqlQuery, new - { - StatusName = queryDto.StatusName, - Group = queryDto.Group, - Name = queryDto.Name, - Content = queryDto.Content, - Offset = queryDto.CurrentPage * queryDto.PageSize, - Limit = queryDto.PageSize, - }).ToList(); - }); + StatusName = queryDto.StatusName, + Group = queryDto.Group, + Name = queryDto.Name, + Content = queryDto.Content, + Offset = queryDto.CurrentPage * queryDto.PageSize, + Limit = queryDto.PageSize, + }).ToList()); } public int PublishedFailedCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Published", StatusName.Failed); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Published", StatusName.Failed)); } public int PublishedProcessingCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Published", StatusName.Processing); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Published", StatusName.Processing)); } public int PublishedSucceededCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Published", StatusName.Succeeded); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Published", StatusName.Succeeded)); } public int ReceivedFailedCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Received", StatusName.Failed); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Received", StatusName.Failed)); } public int ReceivedProcessingCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Received", StatusName.Processing); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Received", StatusName.Processing)); } public int ReceivedSucceededCount() { - return UseConnection(conn => - { - return GetNumberOfMessage(conn, "Received", StatusName.Succeeded); - }); + return UseConnection(conn => GetNumberOfMessage(conn, "Received", StatusName.Succeeded)); } private int GetNumberOfMessage(IDbConnection connection, string tableName, string statusName) diff --git a/src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs b/src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs index c5f407d..daebe5a 100644 --- a/src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs +++ b/src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs @@ -139,7 +139,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; var connection = new SqlConnection(_options.ConnectionString); await connection.OpenAsync(); var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted); - FetchedMessage fetchedMessage = null; + FetchedMessage fetchedMessage; try { fetchedMessage = await connection.QueryFirstOrDefaultAsync(sql, args, transaction); diff --git a/src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs b/src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs index b30c616..9b8090e 100644 --- a/src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs +++ b/src/DotNetCore.CAP.SqlServer/SqlServerStorageTransaction.cs @@ -7,7 +7,7 @@ using DotNetCore.CAP.Models; namespace DotNetCore.CAP.SqlServer { - public class SqlServerStorageTransaction : IStorageTransaction, IDisposable + public class SqlServerStorageTransaction : IStorageTransaction { private readonly string _schema; diff --git a/src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs b/src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs index e7985d7..4ddecc7 100644 --- a/src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs +++ b/src/DotNetCore.CAP/Abstractions/IConsumerServiceSelector.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace DotNetCore.CAP.Abstractions { @@ -10,7 +9,6 @@ namespace DotNetCore.CAP.Abstractions { /// /// Selects a set of candidates for the current message associated with - /// . /// /// A set of candidates or null. IReadOnlyList SelectCandidates(); diff --git a/src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs b/src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs index b2896c1..b1ae8eb 100644 --- a/src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs +++ b/src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingResult.cs @@ -77,7 +77,7 @@ namespace DotNetCore.CAP.Abstractions.ModelBinding { return IsSuccess == other.IsSuccess && - object.Equals(Model, other.Model); + Equals(Model, other.Model); } /// diff --git a/src/DotNetCore.CAP/Abstractions/TopicAttribute.cs b/src/DotNetCore.CAP/Abstractions/TopicAttribute.cs index bc4bb8f..3dc7308 100644 --- a/src/DotNetCore.CAP/Abstractions/TopicAttribute.cs +++ b/src/DotNetCore.CAP/Abstractions/TopicAttribute.cs @@ -2,6 +2,7 @@ namespace DotNetCore.CAP.Abstractions { + /// /// /// An abstract attribute that for kafka attribute or rabbitmq attribute /// @@ -23,10 +24,5 @@ namespace DotNetCore.CAP.Abstractions /// rabbitmq --> queue.name /// public string Group { get; set; } = "cap.default.group"; - - /// - /// unused now - /// - public bool IsOneWay { get; set; } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs b/src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs index e506721..4e958a3 100644 --- a/src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs +++ b/src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs @@ -3,6 +3,7 @@ using DotNetCore.CAP; using DotNetCore.CAP.Dashboard.GatewayProxy; using Microsoft.Extensions.DependencyInjection; +// ReSharper disable once CheckNamespace namespace Microsoft.AspNetCore.Builder { /// @@ -52,7 +53,7 @@ namespace Microsoft.AspNetCore.Builder var marker = app.ApplicationServices.GetService(); 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(); diff --git a/src/DotNetCore.CAP/CAP.Builder.cs b/src/DotNetCore.CAP/CAP.Builder.cs index f901f55..0ab5c54 100644 --- a/src/DotNetCore.CAP/CAP.Builder.cs +++ b/src/DotNetCore.CAP/CAP.Builder.cs @@ -39,7 +39,7 @@ namespace DotNetCore.CAP /// /// Gets the where MVC services are configured. /// - public IServiceCollection Services { get; private set; } + public IServiceCollection Services { get; } /// /// Adds a scoped service of the type specified in serviceType with an implementation diff --git a/src/DotNetCore.CAP/CAP.Options.cs b/src/DotNetCore.CAP/CAP.Options.cs index 7b6c95d..f2373cb 100644 --- a/src/DotNetCore.CAP/CAP.Options.cs +++ b/src/DotNetCore.CAP/CAP.Options.cs @@ -8,7 +8,7 @@ namespace DotNetCore.CAP /// public class CapOptions { - internal IList Extensions { get; private set; } + internal IList Extensions { get; } /// /// Default value for polling delay timeout, in seconds. diff --git a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs index b3b16aa..4aed1da 100644 --- a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs +++ b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.Reflection; using DotNetCore.CAP; using DotNetCore.CAP.Abstractions; -using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Internal; using DotNetCore.CAP.Processor; using DotNetCore.CAP.Processor.States; using Microsoft.Extensions.DependencyInjection.Extensions; +// ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection { /// diff --git a/src/DotNetCore.CAP/CapCache.cs b/src/DotNetCore.CAP/CapCache.cs index df2f844..06fdf77 100644 --- a/src/DotNetCore.CAP/CapCache.cs +++ b/src/DotNetCore.CAP/CapCache.cs @@ -19,9 +19,9 @@ namespace DotNetCore.CAP /// public Cache() { } - private Dictionary cache = new Dictionary(); - private Dictionary timers = new Dictionary(); - private ReaderWriterLockSlim locker = new ReaderWriterLockSlim(); + private Dictionary _cache = new Dictionary(); + private Dictionary _timers = new Dictionary(); + private ReaderWriterLockSlim _locker = new ReaderWriterLockSlim(); #endregion #region IDisposable implementation & Clear @@ -51,7 +51,7 @@ namespace DotNetCore.CAP { // Dispose managed resources. Clear(); - locker.Dispose(); + _locker.Dispose(); } // Dispose unmanaged resources } @@ -62,21 +62,21 @@ namespace DotNetCore.CAP /// public void Clear() { - locker.EnterWriteLock(); + _locker.EnterWriteLock(); try { try { - foreach (Timer t in timers.Values) + foreach (Timer t in _timers.Values) t.Dispose(); } catch { } - timers.Clear(); - cache.Clear(); + _timers.Clear(); + _cache.Clear(); } - finally { locker.ExitWriteLock(); } + finally { _locker.ExitWriteLock(); } } #endregion @@ -86,22 +86,22 @@ namespace DotNetCore.CAP { Timer timer; - if (timers.TryGetValue(key, out timer)) + if (_timers.TryGetValue(key, out timer)) { if (restartTimerIfExists) { timer.Change( - (cacheTimeout == null ? Timeout.InfiniteTimeSpan : cacheTimeout.Value), + cacheTimeout ?? Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); } } else - timers.Add( + _timers.Add( key, new Timer( new TimerCallback(RemoveByTimer), key, - (cacheTimeout == null ? Timeout.InfiniteTimeSpan : cacheTimeout.Value), + cacheTimeout ?? Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan)); } @@ -125,17 +125,17 @@ namespace DotNetCore.CAP { if (disposed) return; - locker.EnterWriteLock(); + _locker.EnterWriteLock(); try { CheckTimer(key, cacheTimeout, restartTimerIfExists); - if (!cache.ContainsKey(key)) - cache.Add(key, cacheObject); + if (!_cache.ContainsKey(key)) + _cache.Add(key, cacheObject); else - cache[key] = cacheObject; + _cache[key] = cacheObject; } - finally { locker.ExitWriteLock(); } + finally { _locker.ExitWriteLock(); } } /// @@ -164,13 +164,13 @@ namespace DotNetCore.CAP { if (disposed) return default(T); - locker.EnterReadLock(); + _locker.EnterReadLock(); try { 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(); } } /// @@ -187,12 +187,12 @@ namespace DotNetCore.CAP return false; } - locker.EnterReadLock(); + _locker.EnterReadLock(); try { - return cache.TryGetValue(key, out value); + return _cache.TryGetValue(key, out value); } - finally { locker.ExitReadLock(); } + finally { _locker.ExitReadLock(); } } /// @@ -203,22 +203,22 @@ namespace DotNetCore.CAP { if (disposed) return; - locker.EnterWriteLock(); + _locker.EnterWriteLock(); try { - var removers = (from k in cache.Keys.Cast() + var removers = (from k in _cache.Keys.Cast() where keyPattern(k) select k).ToList(); foreach (K workKey in removers) { - try { timers[workKey].Dispose(); } + try { _timers[workKey].Dispose(); } catch { } - timers.Remove(workKey); - cache.Remove(workKey); + _timers.Remove(workKey); + _cache.Remove(workKey); } } - finally { locker.ExitWriteLock(); } + finally { _locker.ExitWriteLock(); } } /// @@ -230,18 +230,18 @@ namespace DotNetCore.CAP { if (disposed) return; - locker.EnterWriteLock(); + _locker.EnterWriteLock(); try { - if (cache.ContainsKey(key)) + if (_cache.ContainsKey(key)) { - try { timers[key].Dispose(); } + try { _timers[key].Dispose(); } catch { } - timers.Remove(key); - cache.Remove(key); + _timers.Remove(key); + _cache.Remove(key); } } - finally { locker.ExitWriteLock(); } + finally { _locker.ExitWriteLock(); } } /// @@ -253,12 +253,12 @@ namespace DotNetCore.CAP { if (disposed) return false; - locker.EnterReadLock(); + _locker.EnterReadLock(); try { - return cache.ContainsKey(key); + return _cache.ContainsKey(key); } - finally { locker.ExitReadLock(); } + finally { _locker.ExitReadLock(); } } #endregion } diff --git a/src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs b/src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs index 2031915..f18d1d0 100644 --- a/src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs +++ b/src/DotNetCore.CAP/Dashboard/CAP.DashboardMiddleware.cs @@ -1,9 +1,11 @@ using System; +using System.Linq; using System.Net; using System.Threading.Tasks; using DotNetCore.CAP.Dashboard; using Microsoft.AspNetCore.Http; +// ReSharper disable once CheckNamespace namespace DotNetCore.CAP { public class DashboardMiddleware @@ -23,10 +25,8 @@ namespace DotNetCore.CAP public Task Invoke(HttpContext context) { - PathString matchedPath; - PathString remainingPath; - - if (context.Request.Path.StartsWithSegments(_options.PathMatch, out matchedPath, out remainingPath)) + if (context.Request.Path.StartsWithSegments(_options.PathMatch, + out var matchedPath, out var remainingPath)) { // Update the path var path = context.Request.Path; @@ -44,18 +44,15 @@ namespace DotNetCore.CAP 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; - context.Response.StatusCode = isAuthenticated == true - ? (int)HttpStatusCode.Forbidden - : (int)HttpStatusCode.Unauthorized; + context.Response.StatusCode = isAuthenticated == true + ? (int)HttpStatusCode.Forbidden + : (int)HttpStatusCode.Unauthorized; - return Task.CompletedTask; - } + return Task.CompletedTask; } dashboardContext.UriMatch = findResult.Item2; diff --git a/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs b/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs index 05dfb84..abd9bf9 100644 --- a/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs +++ b/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptions.cs @@ -1,8 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using DotNetCore.CAP.Dashboard; +// ReSharper disable once CheckNamespace namespace DotNetCore.CAP { public class DashboardOptions diff --git a/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs b/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs index 4ba5515..b5c1c2f 100644 --- a/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs +++ b/src/DotNetCore.CAP/Dashboard/CAP.DashboardOptionsExtensions.cs @@ -2,9 +2,9 @@ namespace DotNetCore.CAP { - using DotNetCore.CAP.Dashboard; - using DotNetCore.CAP.Dashboard.GatewayProxy; - using DotNetCore.CAP.Dashboard.GatewayProxy.Requester; + using Dashboard; + using Dashboard.GatewayProxy; + using Dashboard.GatewayProxy.Requester; using Microsoft.Extensions.DependencyInjection; internal sealed class DashboardOptionsExtension : ICapOptionsExtension @@ -25,8 +25,6 @@ namespace DotNetCore.CAP services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - //services.AddScoped(); - //services.AddScoped(); } } } diff --git a/src/DotNetCore.CAP/Dashboard/Content/css/cap.css b/src/DotNetCore.CAP/Dashboard/Content/css/cap.css index 8258fbc..321659a 100644 --- a/src/DotNetCore.CAP/Dashboard/Content/css/cap.css +++ b/src/DotNetCore.CAP/Dashboard/Content/css/cap.css @@ -310,6 +310,7 @@ a:hover .label-hover { padding: 12px; background-color: #fff; border: 1px solid #e5e5e5; + -ms-border-radius: 3px; border-radius: 3px; } @@ -333,12 +334,14 @@ a:hover .label-hover { .state-card-body { padding: 10px; margin: 10px -12px -12px -12px; + -ms-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; + -ms-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; background-color: #f5f5f5; } - .state-card-body dl { +.state-card-body dl { margin-top: 5px; margin-bottom: 0; } @@ -353,7 +356,7 @@ a:hover .label-hover { .state-card-body .stack-trace { background-color: transparent; padding: 0 20px; - margin-bottom: 0px; + margin-bottom: 0; } .state-card-body .exception-type { @@ -453,6 +456,7 @@ span.metric-default { div.metric { border: solid 1px transparent; + -ms-border-radius: 4px; border-radius: 4px; -webkit-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 { 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; font-size: 26px; text-align: center; diff --git a/src/DotNetCore.CAP/Dashboard/Content/js/cap.js b/src/DotNetCore.CAP/Dashboard/Content/js/cap.js index 9633c73..2314bc7 100644 --- a/src/DotNetCore.CAP/Dashboard/Content/js/cap.js +++ b/src/DotNetCore.CAP/Dashboard/Content/js/cap.js @@ -398,10 +398,10 @@ updateRelativeDates(); setInterval(updateRelativeDates, 30 * 1000); - $('*[title]').tooltip(); + $("*[title]").tooltip(); var self = this; - $('*[data-metric]').each(function () { + $("*[data-metric]").each(function () { var name = $(this).data('metric'); self._metrics.addElement(name, this); }); diff --git a/src/DotNetCore.CAP/Dashboard/DashboardResponse.cs b/src/DotNetCore.CAP/Dashboard/DashboardResponse.cs index 2d04da0..d435f2a 100644 --- a/src/DotNetCore.CAP/Dashboard/DashboardResponse.cs +++ b/src/DotNetCore.CAP/Dashboard/DashboardResponse.cs @@ -24,20 +24,19 @@ namespace DotNetCore.CAP.Dashboard public CapDashboardResponse(HttpContext context) { - if (context == null) throw new ArgumentNullException(nameof(context)); - _context = context; + _context = context ?? throw new ArgumentNullException(nameof(context)); } public override string ContentType { - get { return _context.Response.ContentType; } - set { _context.Response.ContentType = value; } + get => _context.Response.ContentType; + set => _context.Response.ContentType = value; } public override int StatusCode { - get { return _context.Response.StatusCode; } - set { _context.Response.StatusCode = value; } + get => _context.Response.StatusCode; + set => _context.Response.StatusCode = value; } public override Stream Body => _context.Response.Body; diff --git a/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs b/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs index eb23a42..dee7850 100644 --- a/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs +++ b/src/DotNetCore.CAP/Dashboard/DashboardRoutes.cs @@ -125,11 +125,6 @@ namespace DotNetCore.CAP.Dashboard return $"{GetContentFolderNamespace(contentFolder)}.{resourceName}"; } - private static EnqueuedState CreateEnqueuedState() - { - return new EnqueuedState(); - } - private static Assembly GetExecutingAssembly() { return typeof(DashboardRoutes).GetTypeInfo().Assembly; diff --git a/src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs b/src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs index ef749cd..ea9f677 100644 --- a/src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs +++ b/src/DotNetCore.CAP/Dashboard/EmbeddedResourceDispatcher.cs @@ -15,12 +15,16 @@ namespace DotNetCore.CAP.Dashboard Assembly assembly, string resourceName) { - if (contentType == null) throw new ArgumentNullException(nameof(contentType)); - if (assembly == null) throw new ArgumentNullException(nameof(assembly)); - - _assembly = assembly; - _resourceName = resourceName; - _contentType = contentType; + if (assembly != null) + { + _assembly = assembly; + _resourceName = resourceName; + _contentType = contentType ?? throw new ArgumentNullException(nameof(contentType)); + } + else + { + throw new ArgumentNullException(nameof(assembly)); + } } public Task Dispatch(DashboardContext context) diff --git a/src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs b/src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs index e4f7c05..b4ba407 100644 --- a/src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs +++ b/src/DotNetCore.CAP/Dashboard/GatewayProxy/DownstreamUrl.cs @@ -7,6 +7,6 @@ Value = value; } - public string Value { get; private set; } + public string Value { get; } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs b/src/DotNetCore.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs index 9ea04ac..a33568a 100644 --- a/src/DotNetCore.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs +++ b/src/DotNetCore.CAP/Dashboard/GatewayProxy/GatewayProxyMiddleware.cs @@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy { public class GatewayProxyMiddleware { - private const string NODE_COOKIE_NAME = "cap.node"; + public const string NodeCookieName = "cap.node"; private readonly RequestDelegate _next; private readonly ILogger _logger; @@ -45,12 +45,9 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy var request = context.Request; var pathMatch = discoveryOptions.MatchPath; - var isCapRequest = request.Path.StartsWithSegments( - new PathString(pathMatch), - out PathString matchedPath, - out PathString remainingPath); + var isCapRequest = request.Path.StartsWithSegments(new PathString(pathMatch)); - var isSwitchNode = request.Cookies.TryGetValue(NODE_COOKIE_NAME, out string requestNodeId); + var isSwitchNode = request.Cookies.TryGetValue(NodeCookieName, out string requestNodeId); var isCurrentNode = discoveryOptions.NodeId.ToString() == requestNodeId; if (!isCapRequest || !isSwitchNode || isCurrentNode) @@ -80,7 +77,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy } else { - context.Response.Cookies.Delete(NODE_COOKIE_NAME); + context.Response.Cookies.Delete(NodeCookieName); await _next.Invoke(context); } } diff --git a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/HttpClientHttpRequester.cs b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/HttpClientHttpRequester.cs index 5787def..d64cfe9 100644 --- a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/HttpClientHttpRequester.cs +++ b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/HttpClientHttpRequester.cs @@ -31,7 +31,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester catch (Exception exception) { _logger.LogError("Error making http request, exception:" + exception.Message); - throw exception; + throw; } finally { diff --git a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs index 7c2494a..4f28220 100644 --- a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs +++ b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/IHttpClientBuilder.cs @@ -1,4 +1,6 @@ -namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester +using System.Net.Http; + +namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester { public interface IHttpClientBuilder { diff --git a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs index 5ea46ea..02512bc 100644 --- a/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs +++ b/src/DotNetCore.CAP/Dashboard/GatewayProxy/Requester/MemoryHttpClientCache.cs @@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester public void Set(string id, IHttpClient client, TimeSpan expirationTime) { - ConcurrentQueue connectionQueue; - if (_httpClientsCache.TryGetValue(id, out connectionQueue)) + if (_httpClientsCache.TryGetValue(id, out var connectionQueue)) { connectionQueue.Enqueue(client); } @@ -24,15 +23,13 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester public bool Exists(string id) { - ConcurrentQueue connectionQueue; - return _httpClientsCache.TryGetValue(id, out connectionQueue); + return _httpClientsCache.TryGetValue(id, out _); } public IHttpClient Get(string id) { IHttpClient client = null; - ConcurrentQueue connectionQueue; - if (_httpClientsCache.TryGetValue(id, out connectionQueue)) + if (_httpClientsCache.TryGetValue(id, out var connectionQueue)) { connectionQueue.TryDequeue(out client); } @@ -41,8 +38,7 @@ namespace DotNetCore.CAP.Dashboard.GatewayProxy.Requester public void Remove(string id) { - ConcurrentQueue connectionQueue; - _httpClientsCache.TryRemove(id, out connectionQueue); + _httpClientsCache.TryRemove(id, out _); } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/Dashboard/HtmlHelper.cs b/src/DotNetCore.CAP/Dashboard/HtmlHelper.cs index 8d7e42e..b9e9777 100644 --- a/src/DotNetCore.CAP/Dashboard/HtmlHelper.cs +++ b/src/DotNetCore.CAP/Dashboard/HtmlHelper.cs @@ -19,8 +19,7 @@ namespace DotNetCore.CAP.Dashboard public HtmlHelper(RazorPage page) { - if (page == null) throw new ArgumentNullException(nameof(page)); - _page = page; + _page = page ?? throw new ArgumentNullException(nameof(page)); } public NonEscapedString Breadcrumbs(string title, IDictionary items) @@ -35,10 +34,7 @@ namespace DotNetCore.CAP.Dashboard { return SidebarMenu(MessagesSidebarMenu.PublishedItems); } - else - { - return SidebarMenu(MessagesSidebarMenu.ReceivedItems); - } + return SidebarMenu(MessagesSidebarMenu.ReceivedItems); } public NonEscapedString SidebarMenu(IEnumerable> items) @@ -198,11 +194,9 @@ namespace DotNetCore.CAP.Dashboard #region MethodEscaped public NonEscapedString MethodEscaped(MethodInfo method) { - var outputString = string.Empty; - var @public = WrapKeyword("public"); var @async = string.Empty; - var @return = string.Empty; + string @return; var isAwaitable = CoercedAwaitableInfo.IsTypeAwaitable(method.ReturnType, out var coercedAwaitableInfo); if (isAwaitable) @@ -221,7 +215,6 @@ namespace DotNetCore.CAP.Dashboard string paramType = null; string paramName = null; - string paramString = string.Empty; var @params = method.GetParameters(); if (@params.Length == 1) @@ -232,16 +225,9 @@ namespace DotNetCore.CAP.Dashboard paramName = firstParam.Name; } - if (paramType == null) - { - paramString = "();"; - } - else - { - paramString = $"({paramType} {paramName});"; - } + var paramString = paramType == null ? "();" : $"({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); } @@ -261,7 +247,7 @@ namespace DotNetCore.CAP.Dashboard { 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()); } @@ -286,11 +272,6 @@ namespace DotNetCore.CAP.Dashboard return Span("type", value); } - private string WrapString(string value) - { - return Span("string", value); - } - private string Span(string @class, string value) { return $"{value}"; diff --git a/src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs b/src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs index c3a1589..fe5b4a8 100644 --- a/src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs +++ b/src/DotNetCore.CAP/Dashboard/JobHistoryRenderer.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Processor.States; -using Newtonsoft.Json; namespace DotNetCore.CAP.Dashboard { diff --git a/src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs b/src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs index 93dccd6..2cfd092 100644 --- a/src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs +++ b/src/DotNetCore.CAP/Dashboard/JsonDispatcher.cs @@ -23,9 +23,6 @@ namespace DotNetCore.CAP.Dashboard public async Task Dispatch(DashboardContext context) { - var request = context.Request; - var response = context.Response; - string serialized = null; if (_command != null) { diff --git a/src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs b/src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs index 0b37e34..4687d2d 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/BlockMetric.cs @@ -1,6 +1,6 @@ namespace DotNetCore.CAP.Dashboard.Pages { - partial class BlockMetric + internal partial class BlockMetric { public BlockMetric(DashboardMetric dashboardMetric) { diff --git a/src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs b/src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs index 46f6692..20c2339 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/Breadcrumbs.cs @@ -2,7 +2,7 @@ namespace DotNetCore.CAP.Dashboard.Pages { - partial class Breadcrumbs + internal partial class Breadcrumbs { public Breadcrumbs(string title, IDictionary items) { diff --git a/src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs b/src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs index fd7b4f0..641592f 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/NodePage.cs @@ -1,13 +1,12 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using DotNetCore.CAP.NodeDiscovery; using Microsoft.Extensions.DependencyInjection; namespace DotNetCore.CAP.Dashboard.Pages { - partial class NodePage + internal partial class NodePage { - private IList _nodes = null; + private IList _nodes; private INodeDiscoveryProvider _discoveryProvider; public NodePage() diff --git a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs index 2852ba8..6f5e176 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs @@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (String.Compare(StatusName, SucceededState.StateName, true) == 0) + if (string.Compare(StatusName, SucceededState.StateName, StringComparison.OrdinalIgnoreCase) == 0) { return api.PublishedSucceededCount(); } - else if (String.Compare(StatusName, ProcessingState.StateName, true) == 0) + if (string.Compare(StatusName, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase) == 0) { return api.PublishedProcessingCount(); } - else - { - return api.PublishedFailedCount(); - } + return api.PublishedFailedCount(); } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs index 3f9a569..344cf5f 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs @@ -14,18 +14,15 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (String.Compare(StatusName, SucceededState.StateName, true) == 0) + if (string.Compare(StatusName, SucceededState.StateName, StringComparison.OrdinalIgnoreCase) == 0) { return api.ReceivedSucceededCount(); } - else if (String.Compare(StatusName, ProcessingState.StateName, true) == 0) + if (string.Compare(StatusName, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase) == 0) { return api.ReceivedProcessingCount(); } - else - { - return api.ReceivedFailedCount(); - } + return api.ReceivedFailedCount(); } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs b/src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs index 0e9305a..8f79ae3 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/SidebarMenu.cs @@ -3,12 +3,11 @@ using System.Collections.Generic; namespace DotNetCore.CAP.Dashboard.Pages { - partial class SidebarMenu + internal partial class SidebarMenu { public SidebarMenu(IEnumerable> items) { - if (items == null) throw new ArgumentNullException(nameof(items)); - Items = items; + Items = items ?? throw new ArgumentNullException(nameof(items)); } public IEnumerable> Items { get; } diff --git a/src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml b/src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml index beffd68..ca0e7db 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml +++ b/src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.cshtml @@ -39,7 +39,7 @@ { var i = 0; var rowCount = subscriber.Value.Count; - @foreach (var column in subscriber.Value) + foreach (var column in subscriber.Value) { @if (i == 0) diff --git a/src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs b/src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs index 15b54b0..b190cc1 100644 --- a/src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs +++ b/src/DotNetCore.CAP/Dashboard/RouteCollectionExtensions.cs @@ -44,13 +44,13 @@ namespace DotNetCore.CAP.Dashboard public static void AddJsonResult( this RouteCollection routes, string pathTemplate, - Func Jsonfunc) + Func jsonfunc) { if (routes == null) throw new ArgumentNullException(nameof(routes)); if (pathTemplate == null) throw new ArgumentNullException(nameof(pathTemplate)); - if (Jsonfunc == null) throw new ArgumentNullException(nameof(Jsonfunc)); + if (jsonfunc == null) throw new ArgumentNullException(nameof(jsonfunc)); - routes.Add(pathTemplate, new JsonDispatcher(Jsonfunc)); + routes.Add(pathTemplate, new JsonDispatcher(jsonfunc)); } public static void AddPublishBatchCommand( diff --git a/src/DotNetCore.CAP/Dashboard/UrlHelper.cs b/src/DotNetCore.CAP/Dashboard/UrlHelper.cs index 9222379..9eb89d1 100644 --- a/src/DotNetCore.CAP/Dashboard/UrlHelper.cs +++ b/src/DotNetCore.CAP/Dashboard/UrlHelper.cs @@ -9,8 +9,7 @@ namespace DotNetCore.CAP.Dashboard public UrlHelper(DashboardContext context) { - if (context == null) throw new ArgumentNullException(nameof(context)); - _context = context; + _context = context ?? throw new ArgumentNullException(nameof(context)); } public string To(string relativePath) diff --git a/src/DotNetCore.CAP/IBootstrapper.Default.cs b/src/DotNetCore.CAP/IBootstrapper.Default.cs index e4a75d5..fd82b75 100644 --- a/src/DotNetCore.CAP/IBootstrapper.Default.cs +++ b/src/DotNetCore.CAP/IBootstrapper.Default.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -12,7 +11,7 @@ namespace DotNetCore.CAP /// /// Default implement of . /// - public class DefaultBootstrapper : IBootstrapper + internal class DefaultBootstrapper : IBootstrapper { private readonly ILogger _logger; private readonly IApplicationLifetime _appLifetime; diff --git a/src/DotNetCore.CAP/IConsumerHandler.Default.cs b/src/DotNetCore.CAP/IConsumerHandler.Default.cs index 651c622..9bfa2f1 100644 --- a/src/DotNetCore.CAP/IConsumerHandler.Default.cs +++ b/src/DotNetCore.CAP/IConsumerHandler.Default.cs @@ -8,20 +8,17 @@ using DotNetCore.CAP.Models; using DotNetCore.CAP.Processor; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; namespace DotNetCore.CAP { - public class ConsumerHandler : IConsumerHandler, IDisposable + internal class ConsumerHandler : IConsumerHandler { private readonly IServiceProvider _serviceProvider; - private readonly IConsumerInvokerFactory _consumerInvokerFactory; private readonly IConsumerClientFactory _consumerClientFactory; private readonly ILogger _logger; private readonly CancellationTokenSource _cts; private readonly MethodMatcherCache _selector; - private readonly CapOptions _options; private readonly TimeSpan _pollingDelay = TimeSpan.FromSeconds(1); @@ -30,18 +27,14 @@ namespace DotNetCore.CAP public ConsumerHandler( IServiceProvider serviceProvider, - IConsumerInvokerFactory consumerInvokerFactory, IConsumerClientFactory consumerClientFactory, ILogger logger, - MethodMatcherCache selector, - IOptions options) + MethodMatcherCache selector) { _selector = selector; _logger = logger; _serviceProvider = serviceProvider; - _consumerInvokerFactory = consumerInvokerFactory; _consumerClientFactory = consumerClientFactory; - _options = options.Value; _cts = new CancellationTokenSource(); } @@ -99,7 +92,8 @@ namespace DotNetCore.CAP using (var scope = _serviceProvider.CreateScope()) { - var receviedMessage = StoreMessage(scope, message); + StoreMessage(scope, message); + client.Commit(); } Pulse(); @@ -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 messageStore = provider.GetRequiredService(); @@ -120,7 +114,6 @@ namespace DotNetCore.CAP StatusName = StatusName.Scheduled, }; messageStore.StoreReceivedMessageAsync(receivedMessage).GetAwaiter().GetResult(); - return receivedMessage; } public void Pulse() diff --git a/src/DotNetCore.CAP/IProcessingServer.cs b/src/DotNetCore.CAP/IProcessingServer.cs index f5f3533..f145bee 100644 --- a/src/DotNetCore.CAP/IProcessingServer.cs +++ b/src/DotNetCore.CAP/IProcessingServer.cs @@ -2,6 +2,7 @@ namespace DotNetCore.CAP { + /// /// /// A process thread abstract of job process. /// diff --git a/src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs b/src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs index 128b9b7..a684916 100644 --- a/src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs +++ b/src/DotNetCore.CAP/IQueueExecutor.Publish.Base.cs @@ -41,7 +41,7 @@ namespace DotNetCore.CAP var result = await PublishAsync(message.Name, message.Content); sp.Stop(); - var newState = default(IState); + IState newState; if (!result.Succeeded) { var shouldRetry = await UpdateMessageForRetryAsync(message, connection); @@ -78,11 +78,10 @@ namespace DotNetCore.CAP } } - private async Task UpdateMessageForRetryAsync(CapPublishedMessage message, IStorageConnection connection) + private static async Task UpdateMessageForRetryAsync(CapPublishedMessage message, IStorageConnection connection) { var retryBehavior = RetryBehavior.DefaultRetry; - var now = DateTime.Now; var retries = ++message.Retries; if (retries >= retryBehavior.RetryCount) { diff --git a/src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs b/src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs index c043379..2e3cc72 100644 --- a/src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs +++ b/src/DotNetCore.CAP/IQueueExecutor.Subscibe.cs @@ -47,7 +47,7 @@ namespace DotNetCore.CAP var result = await ExecuteSubscribeAsync(message); sp.Stop(); - var newState = default(IState); + IState newState; if (!result.Succeeded) { var shouldRetry = await UpdateMessageForRetryAsync(message, connection); diff --git a/src/DotNetCore.CAP/Infrastructure/Helper.cs b/src/DotNetCore.CAP/Infrastructure/Helper.cs index bbf804d..82d31a8 100644 --- a/src/DotNetCore.CAP/Infrastructure/Helper.cs +++ b/src/DotNetCore.CAP/Infrastructure/Helper.cs @@ -57,8 +57,7 @@ namespace DotNetCore.CAP.Infrastructure public static DateTime DeserializeDateTime(string value) { - long timestamp; - if (long.TryParse(value, out timestamp)) + if (long.TryParse(value, out var timestamp)) { return FromTimestamp(timestamp); } @@ -102,13 +101,13 @@ namespace DotNetCore.CAP.Infrastructure private static bool IsSimpleType(Type type) { return type.GetTypeInfo().IsPrimitive || - type.Equals(typeof(decimal)) || - type.Equals(typeof(string)) || - type.Equals(typeof(DateTime)) || - type.Equals(typeof(Guid)) || - type.Equals(typeof(DateTimeOffset)) || - type.Equals(typeof(TimeSpan)) || - type.Equals(typeof(Uri)); + type == typeof(decimal) || + type == typeof(string) || + type == typeof(DateTime) || + type == typeof(Guid) || + type == typeof(DateTimeOffset) || + type == typeof(TimeSpan) || + type == typeof(Uri); } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs b/src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs index 330f6ac..972c911 100644 --- a/src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs +++ b/src/DotNetCore.CAP/Internal/IConsumerInvoker.Default.cs @@ -45,7 +45,7 @@ namespace DotNetCore.CAP.Internal var jsonConent = _consumerContext.DeliverMessage.Content; var message = serializer.DeSerialize(jsonConent); - object result = null; + object result; if (_executor.MethodParameters.Length > 0) { result = await ExecuteWithParameterAsync(obj, message.Content.ToString()); @@ -68,10 +68,7 @@ namespace DotNetCore.CAP.Internal { return await _executor.ExecuteAsync(@class); } - else - { - return _executor.Execute(@class); - } + return _executor.Execute(@class); } private async Task ExecuteWithParameterAsync(object @class, string parameterString) @@ -87,15 +84,9 @@ namespace DotNetCore.CAP.Internal { return await _executor.ExecuteAsync(@class, bindResult.Model); } - else - { - return _executor.Execute(@class, bindResult.Model); - } - } - else - { - throw new MethodBindException($"Parameters:{firstParameter.Name} bind failed! ParameterString is: {parameterString} "); + return _executor.Execute(@class, bindResult.Model); } + throw new MethodBindException($"Parameters:{firstParameter.Name} bind failed! ParameterString is: {parameterString} "); } catch (FormatException ex) { diff --git a/src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs b/src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs index 9dd0d18..b59e7a6 100644 --- a/src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs +++ b/src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs @@ -8,8 +8,9 @@ using Microsoft.Extensions.DependencyInjection; namespace DotNetCore.CAP.Internal { + /// /// - /// A default implementation. + /// A default implementation. /// public class DefaultConsumerServiceSelector : IConsumerServiceSelector { @@ -39,7 +40,7 @@ namespace DotNetCore.CAP.Internal executorDescriptorList.AddRange(FindConsumersFromInterfaceTypes(_serviceProvider)); - executorDescriptorList.AddRange(FindConsumersFromControllerTypes(_serviceProvider)); + executorDescriptorList.AddRange(FindConsumersFromControllerTypes()); return executorDescriptorList; } @@ -67,8 +68,7 @@ namespace DotNetCore.CAP.Internal } } - private static IEnumerable FindConsumersFromControllerTypes( - IServiceProvider provider) + private static IEnumerable FindConsumersFromControllerTypes() { var executorDescriptorList = new List(); @@ -91,7 +91,7 @@ namespace DotNetCore.CAP.Internal { var topicAttrs = method.GetCustomAttributes(true); - if (topicAttrs.Count() == 0) continue; + if (!topicAttrs.Any()) continue; foreach (var attr in topicAttrs) { diff --git a/src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs b/src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs index d00f8b8..cc4dea3 100644 --- a/src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs +++ b/src/DotNetCore.CAP/Internal/IModelBinder.SimpleType.cs @@ -73,7 +73,7 @@ namespace DotNetCore.CAP.Internal // so we capture the inner exception. exception = ExceptionDispatchInfo.Capture(exception.InnerException).SourceException; } - throw exception; + throw; } } diff --git a/src/DotNetCore.CAP/Internal/ModelBinderFactory.cs b/src/DotNetCore.CAP/Internal/ModelBinderFactory.cs index 5af7337..638beca 100644 --- a/src/DotNetCore.CAP/Internal/ModelBinderFactory.cs +++ b/src/DotNetCore.CAP/Internal/ModelBinderFactory.cs @@ -88,7 +88,7 @@ namespace DotNetCore.CAP.Internal 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) diff --git a/src/DotNetCore.CAP/LoggerExtensions.cs b/src/DotNetCore.CAP/LoggerExtensions.cs index 184a386..e7b8040 100644 --- a/src/DotNetCore.CAP/LoggerExtensions.cs +++ b/src/DotNetCore.CAP/LoggerExtensions.cs @@ -16,11 +16,11 @@ namespace DotNetCore.CAP private static readonly Action _receivedMessageRetryExecuting; private static readonly Action _modelBinderFormattingException; - private static Action _jobFailed; - private static Action _jobFailedWillRetry; - private static Action _jobExecuted; - private static Action _jobRetrying; - private static Action _exceptionOccuredWhileExecutingJob; + private static readonly Action _jobFailed; + private static readonly Action _jobFailedWillRetry; + private static readonly Action _jobExecuted; + private static readonly Action _jobRetrying; + private static readonly Action _exceptionOccuredWhileExecutingJob; static LoggerExtensions() { diff --git a/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs b/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs index aeadd5e..22c448f 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptions.cs @@ -1,4 +1,5 @@ -namespace DotNetCore.CAP +// ReSharper disable once CheckNamespace +namespace DotNetCore.CAP { public class DiscoveryOptions { @@ -32,4 +33,4 @@ public string MatchPath { get; set; } } -} +} \ No newline at end of file diff --git a/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs b/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs index 1181b60..2ebf4f4 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/CAP.DiscoveryOptionsExtensions.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; namespace DotNetCore.CAP { - using DotNetCore.CAP.NodeDiscovery; + using NodeDiscovery; using Microsoft.Extensions.DependencyInjection; internal sealed class DiscoveryOptionsExtension : ICapOptionsExtension diff --git a/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs b/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs index f3c480b..b3558d2 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.Default.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; namespace DotNetCore.CAP.NodeDiscovery { - class DiscoveryProviderFactory : IDiscoveryProviderFactory + internal class DiscoveryProviderFactory : IDiscoveryProviderFactory { public INodeDiscoveryProvider Create(DiscoveryOptions options) { diff --git a/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs b/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs index 315437a..e0c06b8 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/IDiscoveryProviderFactory.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace DotNetCore.CAP.NodeDiscovery +namespace DotNetCore.CAP.NodeDiscovery { - interface IDiscoveryProviderFactory + internal interface IDiscoveryProviderFactory { INodeDiscoveryProvider Create(DiscoveryOptions options); } diff --git a/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs b/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs index 6e53442..cc8c676 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs @@ -39,10 +39,11 @@ namespace DotNetCore.CAP.NodeDiscovery Port = x.Value.Port, Tags = string.Join(", ", x.Value.Tags) }); + var nodeList = nodes.ToList(); - CapCache.Global.AddOrUpdate("cap.nodes.count", nodes.Count(), TimeSpan.FromSeconds(30),true); + CapCache.Global.AddOrUpdate("cap.nodes.count", nodeList.Count, TimeSpan.FromSeconds(30),true); - return nodes.ToList(); + return nodeList; } catch (Exception) { return null; @@ -57,7 +58,7 @@ namespace DotNetCore.CAP.NodeDiscovery Name = _options.NodeName, Address = _options.CurrentNodeHostName, Port = _options.CurrentNodePort, - Tags = new string[] { "CAP", "Client", "Dashboard" }, + Tags = new[] { "CAP", "Client", "Dashboard" }, Check = new AgentServiceCheck { DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(30), diff --git a/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs b/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs index c9a3720..75e2224 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using System.Threading.Tasks; namespace DotNetCore.CAP.NodeDiscovery diff --git a/src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs b/src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs index e20928c..695e236 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/IProcessingServer.Consul.cs @@ -1,25 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace DotNetCore.CAP.NodeDiscovery +namespace DotNetCore.CAP.NodeDiscovery { - class ConsulProcessingNodeServer : IProcessingServer + internal class ConsulProcessingNodeServer : IProcessingServer { - private readonly DiscoveryOptions dashboardOptions; - private readonly IDiscoveryProviderFactory discoveryProviderFactory; + private readonly DiscoveryOptions _dashboardOptions; + private readonly IDiscoveryProviderFactory _discoveryProviderFactory; public ConsulProcessingNodeServer( DiscoveryOptions dashboardOptions, IDiscoveryProviderFactory discoveryProviderFactory) { - this.dashboardOptions = dashboardOptions; - this.discoveryProviderFactory = discoveryProviderFactory; + _dashboardOptions = dashboardOptions; + _discoveryProviderFactory = discoveryProviderFactory; } public void Start() { - var discoveryProvider = discoveryProviderFactory.Create(dashboardOptions); + var discoveryProvider = _discoveryProviderFactory.Create(_dashboardOptions); discoveryProvider.RegisterNode(); } diff --git a/src/DotNetCore.CAP/NodeDiscovery/Node.cs b/src/DotNetCore.CAP/NodeDiscovery/Node.cs index fd3d382..1f50afc 100644 --- a/src/DotNetCore.CAP/NodeDiscovery/Node.cs +++ b/src/DotNetCore.CAP/NodeDiscovery/Node.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace DotNetCore.CAP.NodeDiscovery +namespace DotNetCore.CAP.NodeDiscovery { public class Node { diff --git a/src/DotNetCore.CAP/OperateResult.cs b/src/DotNetCore.CAP/OperateResult.cs index 04aa787..23101f3 100644 --- a/src/DotNetCore.CAP/OperateResult.cs +++ b/src/DotNetCore.CAP/OperateResult.cs @@ -51,8 +51,11 @@ namespace DotNetCore.CAP public static OperateResult Failed(Exception ex, params OperateError[] errors) { - var result = new OperateResult { Succeeded = false }; - result.Exception = ex; + var result = new OperateResult + { + Succeeded = false, + Exception = ex + }; if (errors != null) { result._errors.AddRange(errors); diff --git a/src/DotNetCore.CAP/Processor/IDispatcher.Default.cs b/src/DotNetCore.CAP/Processor/IDispatcher.Default.cs index bbf04fd..9229461 100644 --- a/src/DotNetCore.CAP/Processor/IDispatcher.Default.cs +++ b/src/DotNetCore.CAP/Processor/IDispatcher.Default.cs @@ -3,7 +3,6 @@ using System.Threading; using System.Threading.Tasks; using DotNetCore.CAP.Infrastructure; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace DotNetCore.CAP.Processor @@ -11,24 +10,15 @@ namespace DotNetCore.CAP.Processor public class DefaultDispatcher : IDispatcher { private readonly IQueueExecutorFactory _queueExecutorFactory; - private readonly IServiceProvider _provider; - private readonly ILogger _logger; - private readonly CancellationTokenSource _cts; private readonly TimeSpan _pollingDelay; internal static readonly AutoResetEvent PulseEvent = new AutoResetEvent(true); - public DefaultDispatcher( - IServiceProvider provider, - IQueueExecutorFactory queueExecutorFactory, - IOptions capOptions, - ILogger logger) + public DefaultDispatcher(IQueueExecutorFactory queueExecutorFactory, + IOptions capOptions) { - _logger = logger; _queueExecutorFactory = queueExecutorFactory; - _provider = provider; - _cts = new CancellationTokenSource(); _pollingDelay = TimeSpan.FromSeconds(capOptions.Value.PollingDelay); } @@ -73,7 +63,7 @@ namespace DotNetCore.CAP.Processor private async Task Step(ProcessingContext context) { - var fetched = default(IFetchedMessage); + IFetchedMessage fetched; using (var scopedContext = context.CreateScope()) { var provider = scopedContext.Provider; diff --git a/src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs b/src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs index badec83..85397c2 100644 --- a/src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs +++ b/src/DotNetCore.CAP/Processor/IProcessingServer.Cap.cs @@ -9,16 +9,16 @@ using Microsoft.Extensions.Options; namespace DotNetCore.CAP.Processor { - public class CapProcessingServer : IProcessingServer, IDisposable + public class CapProcessingServer : IProcessingServer { private readonly ILogger _logger; private readonly ILoggerFactory _loggerFactory; private readonly IServiceProvider _provider; private readonly CancellationTokenSource _cts; private readonly CapOptions _options; + private readonly IList _messageDispatchers; private IProcessor[] _processors; - private IList _messageDispatchers; private ProcessingContext _context; private Task _compositeTask; private bool _disposed; @@ -109,7 +109,7 @@ namespace DotNetCore.CAP.Processor private IProcessor[] GetProcessors(int processorCount) { var returnedProcessors = new List(); - for (int i = 0; i < processorCount; i++) + for (var i = 0; i < processorCount; i++) { var messageProcessors = _provider.GetRequiredService(); _messageDispatchers.Add(messageProcessors); diff --git a/src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs b/src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs index e7f261a..375763d 100644 --- a/src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs +++ b/src/DotNetCore.CAP/Processor/IProcessor.PublishQueuer.cs @@ -13,7 +13,6 @@ namespace DotNetCore.CAP.Processor public class PublishQueuer : IProcessor { private readonly ILogger _logger; - private readonly CapOptions _options; private readonly IStateChanger _stateChanger; private readonly IServiceProvider _provider; private readonly TimeSpan _pollingDelay; @@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor IServiceProvider provider) { _logger = logger; - _options = options.Value; _stateChanger = stateChanger; _provider = provider; - _pollingDelay = TimeSpan.FromSeconds(_options.PollingDelay); + var capOptions = options.Value; + _pollingDelay = TimeSpan.FromSeconds(capOptions.PollingDelay); } public async Task ProcessAsync(ProcessingContext context) { + _logger.LogDebug("Publish Queuer start calling."); using (var scope = _provider.CreateScope()) { CapPublishedMessage sentMessage; diff --git a/src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs b/src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs index 4a85fb0..0615af6 100644 --- a/src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs +++ b/src/DotNetCore.CAP/Processor/IProcessor.SubscribeQueuer.cs @@ -12,11 +12,10 @@ namespace DotNetCore.CAP.Processor { public class SubscribeQueuer : IProcessor { - private ILogger _logger; - private CapOptions _options; - private IStateChanger _stateChanger; - private IServiceProvider _provider; - private TimeSpan _pollingDelay; + private readonly ILogger _logger; + private readonly IStateChanger _stateChanger; + private readonly IServiceProvider _provider; + private readonly TimeSpan _pollingDelay; internal static readonly AutoResetEvent PulseEvent = new AutoResetEvent(true); @@ -27,15 +26,16 @@ namespace DotNetCore.CAP.Processor IServiceProvider provider) { _logger = logger; - _options = options.Value; _stateChanger = stateChanger; _provider = provider; - _pollingDelay = TimeSpan.FromSeconds(_options.PollingDelay); + var capOptions = options.Value; + _pollingDelay = TimeSpan.FromSeconds(capOptions.PollingDelay); } public async Task ProcessAsync(ProcessingContext context) { + _logger.LogDebug("SubscribeQueuer start calling."); using (var scope = _provider.CreateScope()) { CapReceivedMessage message; diff --git a/src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs b/src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs index 0a3f240..bc45377 100644 --- a/src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs +++ b/src/DotNetCore.CAP/Processor/States/IState.Succeeded.cs @@ -7,7 +7,7 @@ namespace DotNetCore.CAP.Processor.States { public const string StateName = "Succeeded"; - public TimeSpan? ExpiresAfter { get; private set; } + public TimeSpan? ExpiresAfter { get; } public string Name => StateName; diff --git a/src/DotNetCore.CAP/StateData.cs b/src/DotNetCore.CAP/StateData.cs deleted file mode 100644 index adc3e1f..0000000 --- a/src/DotNetCore.CAP/StateData.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace DotNetCore.CAP -{ - public class StateData - { - public string Name { get; set; } - - public string Reason { get; set; } - - public IDictionary Data { get; set; } - } -} \ No newline at end of file From 72ab74b6527f702e86bbffce76cf4b256027acd2 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Thu, 28 Sep 2017 23:34:59 +0800 Subject: [PATCH 2/4] add resources. --- .../Content/resx/Strings.Designer.cs | 24 ++++++++++++++++--- .../Dashboard/Content/resx/Strings.resx | 10 ++++++-- .../Dashboard/Content/resx/Strings.zh.resx | 8 ++++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.Designer.cs b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.Designer.cs index b54586f..535eee5 100644 --- a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.Designer.cs +++ b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.Designer.cs @@ -268,11 +268,20 @@ namespace DotNetCore.CAP.Dashboard.Resources { } /// - /// Looks up a localized string similar to Requeue jobs. + /// Looks up a localized string similar to ReExecution. /// - public static string Common_RequeueJobs { + public static string Common_ReConsume { get { - return ResourceManager.GetString("Common_RequeueJobs", resourceCulture); + return ResourceManager.GetString("Common_ReConsume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Requeue messages. + /// + public static string Common_RequeueMessages { + get { + return ResourceManager.GetString("Common_RequeueMessages", resourceCulture); } } @@ -546,6 +555,15 @@ namespace DotNetCore.CAP.Dashboard.Resources { } } + /// + /// Looks up a localized string similar to State. + /// + public static string MessagesPage_Table_State { + get { + return ResourceManager.GetString("MessagesPage_Table_State", resourceCulture); + } + } + /// /// Looks up a localized string similar to Active Connections. /// diff --git a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.resx b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.resx index 7fc30f8..aad31b1 100644 --- a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.resx +++ b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.resx @@ -162,8 +162,8 @@ Reason - - Requeue jobs + + Requeue messages Retry @@ -384,4 +384,10 @@ Switch + + ReExecution + + + State + \ No newline at end of file diff --git a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.zh.resx b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.zh.resx index c6eed95..05ce561 100644 --- a/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.zh.resx +++ b/src/DotNetCore.CAP/Dashboard/Content/resx/Strings.zh.resx @@ -162,7 +162,7 @@ 原因 - + 重新加入队列 @@ -408,4 +408,10 @@ 切换到 + + 重新消费 + + + 状态 + \ No newline at end of file From 1d408d0986f110c89450242c0315a565b1ae4872 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Thu, 28 Sep 2017 23:35:51 +0800 Subject: [PATCH 3/4] processing pages will contains Scheduled and Enqueued messages. --- .../SqlServerMonitoringApi.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs b/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs index 6cfb4e2..421bb11 100644 --- a/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs +++ b/src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs @@ -32,7 +32,7 @@ select count(Id) from [{0}].Published with (nolock) where StatusName = N'Succeed select count(Id) from [{0}].Received with (nolock) where StatusName = N'Succeeded'; select count(Id) from [{0}].Published with (nolock) where StatusName = N'Failed'; select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed'; -select count(Id) from [{0}].Published with (nolock) where StatusName = N'Processing'; +select count(Id) from [{0}].Published with (nolock) where StatusName in (N'Processing',N'Scheduled',N'Enqueued'); select count(Id) from [{0}].Received with (nolock) where StatusName = N'Processing';", _options.Schema); @@ -75,7 +75,14 @@ _options.Schema); var where = string.Empty; if (!string.IsNullOrEmpty(queryDto.StatusName)) { - where += " and statusname=@StatusName"; + if (string.Equals(queryDto.StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase)) + { + where += " and statusname in (N'Processing',N'Scheduled',N'Enqueued')"; + } + else + { + where += " and statusname=@StatusName"; + } } if (!string.IsNullOrEmpty(queryDto.Name)) { @@ -135,7 +142,10 @@ _options.Schema); private int GetNumberOfMessage(IDbConnection connection, string tableName, string statusName) { - var sqlQuery = $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName = @state"; + var sqlQuery = statusName == StatusName.Processing + ? $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName in (N'Processing',N'Scheduled',N'Enqueued')" + : $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName = @state"; + var count = connection.ExecuteScalar(sqlQuery, new { state = statusName }); return count; } @@ -166,6 +176,7 @@ _options.Schema); string statusName, IDictionary keyMaps) { + //SQL Server 2012+ string sqlQuery = $@" with aggr as ( From a16041cd4985e41e874d3144baccb5889eee6245 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Thu, 28 Sep 2017 23:35:57 +0800 Subject: [PATCH 4/4] processing pages will contains Scheduled and Enqueued messages. --- .../Dashboard/Pages/PublishedPage.cs | 4 +- .../Dashboard/Pages/PublishedPage.cshtml | 14 +- .../Pages/PublishedPage1.generated.cs | 828 ++++++++++-------- .../Dashboard/Pages/ReceivedPage.cs | 4 +- .../Dashboard/Pages/ReceivedPage.cshtml | 16 +- .../Dashboard/Pages/ReceivedPage.generated.cs | 780 +++++++++-------- 6 files changed, 893 insertions(+), 753 deletions(-) diff --git a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs index 6f5e176..5b743f9 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cs @@ -14,11 +14,11 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (string.Compare(StatusName, SucceededState.StateName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(StatusName, SucceededState.StateName, StringComparison.CurrentCultureIgnoreCase)) { return api.PublishedSucceededCount(); } - if (string.Compare(StatusName, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase)) { return api.PublishedProcessingCount(); } diff --git a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml index 3590f22..0e96728 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml +++ b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.cshtml @@ -32,7 +32,7 @@
- @Html.JobsSidebar(MessageType.Publish) + @Html.MessagesSidebar(MessageType.Publish)

@Strings.PublishedPage_Title

@@ -67,7 +67,7 @@ data-loading-text="@Strings.Common_Enqueueing" disabled="disabled"> - @Strings.Common_RequeueJobs + @Strings.Common_RequeueMessages @Html.PerPageSelector(pager) @@ -83,6 +83,10 @@ @Strings.MessagesPage_Table_Code @Strings.MessagesPage_Table_Name @Strings.MessagesPage_Table_Retries + @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + @Strings.MessagesPage_Table_State + } @Strings.MessagesPage_Table_ExpiresAt @@ -102,6 +106,12 @@ @message.Retries + @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + + @message.StatusName + + } @if (message.ExpiresAt.HasValue) { diff --git a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs index 89a19bb..4b37b27 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/PublishedPage1.generated.cs @@ -11,46 +11,46 @@ namespace DotNetCore.CAP.Dashboard.Pages { - - #line 2 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line 2 "..\..\PublishedPage.cshtml" using System; - - #line default - #line hidden + +#line default +#line hidden using System.Collections.Generic; using System.Linq; using System.Text; - - #line 4 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line 4 "..\..\PublishedPage.cshtml" using DotNetCore.CAP.Dashboard; - - #line default - #line hidden - - #line 6 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line default +#line hidden + +#line 6 "..\..\PublishedPage.cshtml" using DotNetCore.CAP.Dashboard.Monitoring; - - #line default - #line hidden - - #line 5 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line default +#line hidden + +#line 5 "..\..\PublishedPage.cshtml" using DotNetCore.CAP.Dashboard.Pages; - - #line default - #line hidden - - #line 7 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line default +#line hidden + +#line 7 "..\..\PublishedPage.cshtml" using DotNetCore.CAP.Dashboard.Resources; - - #line default - #line hidden - - #line 3 "..\..\Dashboard\Pages\PublishedPage.cshtml" + +#line default +#line hidden + +#line 3 "..\..\PublishedPage.cshtml" using DotNetCore.CAP.Models; - - #line default - #line hidden - + +#line default +#line hidden + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] internal partial class PublishedPage : RazorPage { @@ -60,7 +60,7 @@ namespace DotNetCore.CAP.Dashboard.Pages { -WriteLiteral("\r\n"); + WriteLiteral("\r\n"); @@ -70,438 +70,496 @@ WriteLiteral("\r\n"); - - #line 9 "..\..\Dashboard\Pages\PublishedPage.cshtml" - - Layout = new LayoutPage(Strings.PublishedMessagesPage_Title); - int from, perPage; +#line 9 "..\..\PublishedPage.cshtml" - int.TryParse(Query("from"), out from); - int.TryParse(Query("count"), out perPage); - string name = Query("name"); - string content = Query("content"); + Layout = new LayoutPage(Strings.PublishedMessagesPage_Title); - var monitor = Storage.GetMonitoringApi(); - var pager = new Pager(from, perPage, GetTotal(monitor)); - var queryDto = new MessageQueryDto - { - MessageType = MessageType.Publish, - Name = name, - Content = content, - StatusName = StatusName, - CurrentPage = pager.CurrentPage - 1, - PageSize = pager.RecordsPerPage - }; - var succeededMessages = monitor.Messages(queryDto); + int from, perPage; + int.TryParse(Query("from"), out from); + int.TryParse(Query("count"), out perPage); + string name = Query("name"); + string content = Query("content"); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n
\r\n "); + var monitor = Storage.GetMonitoringApi(); + var pager = new Pager(from, perPage, GetTotal(monitor)); + var queryDto = new MessageQueryDto + { + MessageType = MessageType.Publish, + Name = name, + Content = content, + StatusName = StatusName, + CurrentPage = pager.CurrentPage - 1, + PageSize = pager.RecordsPerPage + }; + var succeededMessages = monitor.Messages(queryDto); - - #line 35 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Html.MessagesSidebar(MessageType.Publish)); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n
\r\n

"); +#line default +#line hidden + WriteLiteral("\r\n
\r\n
\r\n "); - - #line 38 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.PublishedPage_Title); - - #line default - #line hidden -WriteLiteral("

\r\n\r\n"); +#line 35 "..\..\PublishedPage.cshtml" + Write(Html.MessagesSidebar(MessageType.Publish)); - - #line 40 "..\..\Dashboard\Pages\PublishedPage.cshtml" - if (succeededMessages.Count == 0) - { +#line default +#line hidden + WriteLiteral("\r\n
\r\n
\r\n

"); - - #line default - #line hidden -WriteLiteral("
\r\n "); - - #line 43 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_NoMessages); +#line 38 "..\..\PublishedPage.cshtml" + Write(Strings.PublishedPage_Title); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n"); +#line default +#line hidden + WriteLiteral("

\r\n\r\n"); - - #line 45 "..\..\Dashboard\Pages\PublishedPage.cshtml" - } - else - { - - #line default - #line hidden -WriteLiteral(@"
-
-
- - \r\n "); + - - #line 52 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Query_MessageName); +#line 43 "..\..\PublishedPage.cshtml" + Write(Strings.MessagesPage_NoMessages); - - #line default - #line hidden -WriteLiteral("\" />\r\n \r\n
\r\n
\r\n " + -" \r\n"); - - #line 56 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Query("content")); - - #line default - #line hidden -WriteLiteral("\" placeholder=\""); +#line 45 "..\..\PublishedPage.cshtml" + } + else + { - - #line 56 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Query_MessageBody); - - #line default - #line hidden -WriteLiteral("\" />\r\n \r\n " + -" +
- -
-
-
+
+ \r\n\r\n "); +#line default +#line hidden + WriteLiteral("\"\r\n disabled=\"disabled\">\r\n \r\n "); - - #line 73 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Html.PerPageSelector(pager)); - - #line default - #line hidden -WriteLiteral(@" -
-
- - - - - \r\n \r\n \r\n"); + + + +#line 89 "..\..\PublishedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n \r\n \r\n " + + " \r\n"); + + + +#line 94 "..\..\PublishedPage.cshtml" + foreach (var message in succeededMessages) + { + + +#line default +#line hidden + WriteLiteral(" \r\n " + + " \r\n \r\n \r\n \r\n"); + + + +#line 109 "..\..\PublishedPage.cshtml" + if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + + +#line default +#line hidden + WriteLiteral(" \r\n"); + + + +#line 114 "..\..\PublishedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n\r\n \r\n"); + + + +#line 123 "..\..\PublishedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n
- - "); +#line 70 "..\..\PublishedPage.cshtml" + Write(Strings.Common_RequeueMessages); - - #line 83 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Table_Code); +#line default +#line hidden + WriteLiteral("\r\n \r\n\r\n "); - - #line default - #line hidden -WriteLiteral(""); - - #line 84 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Table_Name); +#line 73 "..\..\PublishedPage.cshtml" + Write(Html.PerPageSelector(pager)); - - #line default - #line hidden -WriteLiteral(""); +#line default +#line hidden + WriteLiteral(@" + - - #line 85 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Table_Retries); +
+ + + + + \r\n \r\n \r\n \r\n " + -" \r\n"); +#line 83 "..\..\PublishedPage.cshtml" + Write(Strings.MessagesPage_Table_Code); - - #line 90 "..\..\Dashboard\Pages\PublishedPage.cshtml" - foreach (var message in succeededMessages) - { +#line default +#line hidden + WriteLiteral("\r\n \r\n " + -" \r\n " + -" \r\n " + -"\r\n " + -"\r\n\r\n \r\n"); - - - - #line 113 "..\..\Dashboard\Pages\PublishedPage.cshtml" - } +#line 86 "..\..\PublishedPage.cshtml" + if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { - - #line default - #line hidden -WriteLiteral(" \r\n
+ + "); - - #line default - #line hidden -WriteLiteral(""); - - #line 86 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Strings.MessagesPage_Table_ExpiresAt); - - - #line default - #line hidden -WriteLiteral("
"); - - #line default - #line hidden -WriteLiteral("
\r\n \r\n \r\n "); - - #line 97 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Url.To("/published/message/")+message.Id); - - #line default - #line hidden -WriteLiteral("\' class=\"openModal\">#"); - - - - #line 97 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(message.Id); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n " + -" \r\n "); - - - - #line 100 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(message.Name); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n "); +#line 85 "..\..\PublishedPage.cshtml" + Write(Strings.MessagesPage_Table_Retries); - - #line 103 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(message.Retries); - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); +#line default +#line hidden + WriteLiteral("\r\n"); - - #line 106 "..\..\Dashboard\Pages\PublishedPage.cshtml" - if (message.ExpiresAt.HasValue) - { - - - #line default - #line hidden - - #line 108 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Html.RelativeTime(message.ExpiresAt.Value)); - - - #line default - #line hidden - - #line 108 "..\..\Dashboard\Pages\PublishedPage.cshtml" - - } - - #line default - #line hidden -WriteLiteral("
\r\n <" + -"/div>\r\n "); - - - - #line 117 "..\..\Dashboard\Pages\PublishedPage.cshtml" - Write(Html.Paginator(pager)); - - - #line default - #line hidden -WriteLiteral("\r\n
\r\n"); - - - - #line 119 "..\..\Dashboard\Pages\PublishedPage.cshtml" - - - - #line default - #line hidden -WriteLiteral(@"
-
-
-
-
- -

Message Content

-
-
-
-
- \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n " + -"
\r\n
\r\n"); +#line default +#line hidden + WriteLiteral("
"); - - #line 140 "..\..\Dashboard\Pages\PublishedPage.cshtml" - } - - #line default - #line hidden -WriteLiteral(" \r\n"); + +#line 88 "..\..\PublishedPage.cshtml" + Write(Strings.MessagesPage_Table_State); + + +#line default +#line hidden + WriteLiteral(""); + + + +#line 90 "..\..\PublishedPage.cshtml" + Write(Strings.MessagesPage_Table_ExpiresAt); + + +#line default +#line hidden + WriteLiteral("
\r\n \r\n \r\n \r\n \r\n " + + " "); + + + +#line 104 "..\..\PublishedPage.cshtml" + Write(message.Name); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n " + + " "); + + + +#line 107 "..\..\PublishedPage.cshtml" + Write(message.Retries); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n "); + + + +#line 112 "..\..\PublishedPage.cshtml" + Write(message.StatusName); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n"); + + + +#line 116 "..\..\PublishedPage.cshtml" + if (message.ExpiresAt.HasValue) + { + + +#line default +#line hidden + +#line 118 "..\..\PublishedPage.cshtml" + Write(Html.RelativeTime(message.ExpiresAt.Value)); + + +#line default +#line hidden + +#line 118 "..\..\PublishedPage.cshtml" + + } + + +#line default +#line hidden + WriteLiteral("
\r\n
\r\n " + + " "); + + + +#line 127 "..\..\PublishedPage.cshtml" + Write(Html.Paginator(pager)); + + +#line default +#line hidden + WriteLiteral("\r\n
\r\n"); + + + +#line 129 "..\..\PublishedPage.cshtml" + + + +#line default +#line hidden + WriteLiteral(@"
+
+
+
+
+ +

Message Content

+
+
+
+
+ \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
<" + + "!-- /.modal -->\r\n
\r\n"); + + + +#line 150 "..\..\PublishedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral("
\r\n
"); } diff --git a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs index 344cf5f..7a39157 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cs @@ -14,11 +14,11 @@ namespace DotNetCore.CAP.Dashboard.Pages public int GetTotal(IMonitoringApi api) { - if (string.Compare(StatusName, SucceededState.StateName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(StatusName, SucceededState.StateName, StringComparison.CurrentCultureIgnoreCase)) { return api.ReceivedSucceededCount(); } - if (string.Compare(StatusName, ProcessingState.StateName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase)) { return api.ReceivedProcessingCount(); } diff --git a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml index 3d949b7..32866d6 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml +++ b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.cshtml @@ -22,7 +22,7 @@ var queryDto = new MessageQueryDto { MessageType = MessageType.Subscribe, - Group =group, + Group = group, Name = name, Content = content, StatusName = StatusName, @@ -34,7 +34,7 @@
- @Html.JobsSidebar(MessageType.Subscribe) + @Html.MessagesSidebar(MessageType.Subscribe)

@Strings.ReceivedPage_Title

@@ -72,7 +72,7 @@ data-loading-text="@Strings.Common_Enqueueing" disabled="disabled"> - @Strings.Common_RequeueJobs + @Strings.Common_ReConsume @Html.PerPageSelector(pager) @@ -89,6 +89,10 @@ @Strings.MessagesPage_Table_Group @Strings.MessagesPage_Table_Name @Strings.MessagesPage_Table_Retries + @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + @Strings.MessagesPage_Table_State + } @Strings.MessagesPage_Table_ExpiresAt @@ -111,6 +115,12 @@ @message.Retries + @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + + @message.StatusName + + } @if (message.ExpiresAt.HasValue) { diff --git a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs index 891678b..8a2b537 100644 --- a/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs +++ b/src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs @@ -11,46 +11,46 @@ namespace DotNetCore.CAP.Dashboard.Pages { - - #line 2 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line 2 "..\..\ReceivedPage.cshtml" using System; - - #line default - #line hidden + +#line default +#line hidden using System.Collections.Generic; using System.Linq; using System.Text; - - #line 4 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line 4 "..\..\ReceivedPage.cshtml" using DotNetCore.CAP.Dashboard; - - #line default - #line hidden - - #line 6 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line default +#line hidden + +#line 6 "..\..\ReceivedPage.cshtml" using DotNetCore.CAP.Dashboard.Monitoring; - - #line default - #line hidden - - #line 5 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line default +#line hidden + +#line 5 "..\..\ReceivedPage.cshtml" using DotNetCore.CAP.Dashboard.Pages; - - #line default - #line hidden - - #line 7 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line default +#line hidden + +#line 7 "..\..\ReceivedPage.cshtml" using DotNetCore.CAP.Dashboard.Resources; - - #line default - #line hidden - - #line 3 "..\..\Dashboard\Pages\ReceivedPage.cshtml" + +#line default +#line hidden + +#line 3 "..\..\ReceivedPage.cshtml" using DotNetCore.CAP.Models; - - #line default - #line hidden - + +#line default +#line hidden + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] internal partial class ReceivedPage : RazorPage { @@ -60,7 +60,7 @@ namespace DotNetCore.CAP.Dashboard.Pages { -WriteLiteral("\r\n"); + WriteLiteral("\r\n"); @@ -70,170 +70,170 @@ WriteLiteral("\r\n"); - - #line 9 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - - Layout = new LayoutPage(Strings.ReceivedMessagesPage_Title); - int from, perPage; +#line 9 "..\..\ReceivedPage.cshtml" - int.TryParse(Query("from"), out from); - int.TryParse(Query("count"), out perPage); - string group = Query("group"); - string name = Query("name"); - string content = Query("content"); + Layout = new LayoutPage(Strings.ReceivedMessagesPage_Title); - var monitor = Storage.GetMonitoringApi(); - var pager = new Pager(from, perPage, GetTotal(monitor)); - var queryDto = new MessageQueryDto - { - MessageType = MessageType.Subscribe, - Group =group, - Name = name, - Content = content, - StatusName = StatusName, - CurrentPage = pager.CurrentPage - 1, - PageSize = pager.RecordsPerPage - }; - var succeededMessages = monitor.Messages(queryDto); + int from, perPage; + int.TryParse(Query("from"), out from); + int.TryParse(Query("count"), out perPage); + string group = Query("group"); + string name = Query("name"); + string content = Query("content"); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n
\r\n "); + var monitor = Storage.GetMonitoringApi(); + var pager = new Pager(from, perPage, GetTotal(monitor)); + var queryDto = new MessageQueryDto + { + MessageType = MessageType.Subscribe, + Group = group, + Name = name, + Content = content, + StatusName = StatusName, + CurrentPage = pager.CurrentPage - 1, + PageSize = pager.RecordsPerPage + }; + var succeededMessages = monitor.Messages(queryDto); - - #line 37 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Html.MessagesSidebar(MessageType.Subscribe)); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n
\r\n

"); +#line default +#line hidden + WriteLiteral("\r\n
\r\n
\r\n "); - - #line 40 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.ReceivedPage_Title); - - #line default - #line hidden -WriteLiteral("

\r\n\r\n"); +#line 37 "..\..\ReceivedPage.cshtml" + Write(Html.MessagesSidebar(MessageType.Subscribe)); - - #line 42 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - if (succeededMessages.Count == 0) - { +#line default +#line hidden + WriteLiteral("\r\n
\r\n
\r\n

"); - - #line default - #line hidden -WriteLiteral("
\r\n "); - - #line 45 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_NoMessages); +#line 40 "..\..\ReceivedPage.cshtml" + Write(Strings.ReceivedPage_Title); - - #line default - #line hidden -WriteLiteral("\r\n
\r\n"); +#line default +#line hidden + WriteLiteral("

\r\n\r\n"); + + + +#line 42 "..\..\ReceivedPage.cshtml" + if (succeededMessages.Count == 0) + { + + +#line default +#line hidden + WriteLiteral("
\r\n "); + + + +#line 45 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_NoMessages); - - #line 47 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - } - else - { - - #line default - #line hidden -WriteLiteral(@"
+#line default +#line hidden + WriteLiteral("\r\n
\r\n"); + + + +#line 47 "..\..\ReceivedPage.cshtml" + } + else + { + + +#line default +#line hidden + WriteLiteral(@"
- \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n " + + " \r\n \r\n
\r\n
\r\n " + -" \r\n \r\n " + -" + + +#line 63 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Query_Button); + + +#line default +#line hidden + WriteLiteral(@"
@@ -244,45 +244,45 @@ WriteLiteral(@" data-url="""); - - #line 71 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Url.To("/received/requeue")); - - #line default - #line hidden -WriteLiteral("\"\r\n data-loading-text=\""); +#line 71 "..\..\ReceivedPage.cshtml" + Write(Url.To("/received/requeue")); + + +#line default +#line hidden + WriteLiteral("\"\r\n data-loading-text=\""); + + + +#line 72 "..\..\ReceivedPage.cshtml" + Write(Strings.Common_Enqueueing); + + +#line default +#line hidden + WriteLiteral("\"\r\n disabled=\"disabled\">\r\n \r\n "); - - #line 72 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.Common_Enqueueing); - - #line default - #line hidden -WriteLiteral("\"\r\n disabled=\"disabled\">\r\n \r\n "); +#line 75 "..\..\ReceivedPage.cshtml" + Write(Strings.Common_ReConsume); - - #line 75 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.Common_RequeueJobs); +#line default +#line hidden + WriteLiteral("\r\n \r\n\r\n "); + - - #line default - #line hidden -WriteLiteral("\r\n \r\n\r\n "); +#line 78 "..\..\ReceivedPage.cshtml" + Write(Html.PerPageSelector(pager)); - - #line 78 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Html.PerPageSelector(pager)); - - #line default - #line hidden -WriteLiteral(@" +#line default +#line hidden + WriteLiteral(@"
@@ -295,192 +295,254 @@ WriteLiteral(@" "); - - #line 88 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_Table_Code); - - #line default - #line hidden -WriteLiteral("\r\n "); +#line 88 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Table_Code); - - #line 89 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_Table_Group); +#line default +#line hidden + WriteLiteral("\r\n "); - - #line default - #line hidden -WriteLiteral("\r\n "); - - #line 90 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_Table_Name); +#line 89 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Table_Group); - - #line default - #line hidden -WriteLiteral("\r\n "); +#line default +#line hidden + WriteLiteral("\r\n "); - - #line 91 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_Table_Retries); - - #line default - #line hidden -WriteLiteral("\r\n "); +#line 90 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Table_Name); - - #line 92 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Strings.MessagesPage_Table_ExpiresAt); - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n " + -" \r\n"); +#line default +#line hidden + WriteLiteral("\r\n "); - - #line 96 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - foreach (var message in succeededMessages) - { - - #line default - #line hidden -WriteLiteral(" \r\n " + -" \r\n \r\n"); - - #line default - #line hidden -WriteLiteral("\" />\r\n \r\n " + -" \r\n \r\n \r\n " + -" \r\n "); +#line 94 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Table_State); - - #line 106 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(message.Group); - - #line default - #line hidden -WriteLiteral("\r\n \r\n " + -"\r\n "); +#line default +#line hidden + WriteLiteral("\r\n"); - - #line 109 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(message.Name); - - #line default - #line hidden -WriteLiteral("\r\n \r\n " + -"\r\n "); +#line 95 "..\..\ReceivedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" "); - - #line 112 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(message.Retries); - - #line default - #line hidden -WriteLiteral("\r\n \r\n " + -"\r\n"); +#line 96 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Table_ExpiresAt); - - #line 115 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - if (message.ExpiresAt.HasValue) - { - - - #line default - #line hidden - - #line 117 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - Write(Html.RelativeTime(message.ExpiresAt.Value)); +#line default +#line hidden + WriteLiteral("\r\n \r\n \r\n " + + " \r\n"); - - #line default - #line hidden - - #line 117 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - - } - - #line default - #line hidden -WriteLiteral(" \r\n\r\n \r\n"); +#line 100 "..\..\ReceivedPage.cshtml" + foreach (var message in succeededMessages) + { - - #line 122 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - } - - #line default - #line hidden -WriteLiteral(" \r\n \r\n <" + -"/div>\r\n "); +#line default +#line hidden + WriteLiteral(" \r\n " + + " \r\n \r\n"); +#line 104 "..\..\ReceivedPage.cshtml" + Write(message.Id); - - #line 128 "..\..\Dashboard\Pages\ReceivedPage.cshtml" +#line default +#line hidden + WriteLiteral("\" />\r\n \r\n " + + " \r\n \r\n \r\n " + + " \r\n "); + + + +#line 110 "..\..\ReceivedPage.cshtml" + Write(message.Group); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n " + + "\r\n "); + + + +#line 113 "..\..\ReceivedPage.cshtml" + Write(message.Name); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n " + + "\r\n "); + + + +#line 116 "..\..\ReceivedPage.cshtml" + Write(message.Retries); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n"); + + + +#line 118 "..\..\ReceivedPage.cshtml" + if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase)) + { + + +#line default +#line hidden + WriteLiteral(" \r\n " + + " "); + + + +#line 121 "..\..\ReceivedPage.cshtml" + Write(message.StatusName); + + +#line default +#line hidden + WriteLiteral("\r\n \r\n"); + + + +#line 123 "..\..\ReceivedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n"); + + + +#line 125 "..\..\ReceivedPage.cshtml" + if (message.ExpiresAt.HasValue) + { + + +#line default +#line hidden + +#line 127 "..\..\ReceivedPage.cshtml" + Write(Html.RelativeTime(message.ExpiresAt.Value)); + + +#line default +#line hidden + +#line 127 "..\..\ReceivedPage.cshtml" + + } + + +#line default +#line hidden + WriteLiteral(" \r\n\r\n \r\n"); + + + +#line 132 "..\..\ReceivedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n \r\n <" + + "/div>\r\n "); + + + +#line 136 "..\..\ReceivedPage.cshtml" + Write(Html.Paginator(pager)); + + +#line default +#line hidden + WriteLiteral("\r\n
\r\n"); + + + +#line 138 "..\..\ReceivedPage.cshtml" + + + +#line default +#line hidden + WriteLiteral(@"
@@ -494,59 +556,59 @@ WriteLiteral(@"
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n " + -"
\r\n
\r\n"); +#line 152 "..\..\ReceivedPage.cshtml" + Write(Strings.MessagesPage_Modal_Expand); - - #line 149 "..\..\Dashboard\Pages\ReceivedPage.cshtml" - } - - #line default - #line hidden -WriteLiteral("
\r\n
"); +#line default +#line hidden + WriteLiteral("\r\n \r\n
\r\n
\r\n
\r\n " + + "
\r\n
\r\n"); + + + +#line 159 "..\..\ReceivedPage.cshtml" + } + + +#line default +#line hidden + WriteLiteral("
\r\n
"); }