Browse Source

Merge branch 'develop' of https://github.com/dotnetcore/CAP into develop

master
Savorboard 7 years ago
parent
commit
8a56c35a8f
22 changed files with 63 additions and 55 deletions
  1. +1
    -1
      src/DotNetCore.CAP/Dashboard/JsonStats.cs
  2. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs
  3. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/LayoutPage.generated.cs
  4. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/NodePage.generated.cs
  5. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.generated.cs
  6. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs
  7. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.generated.cs
  8. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_BlockMetric.generated.cs
  9. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_Breadcrumbs.generated.cs
  10. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_InlineMetric.generated.cs
  11. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_Navigation.generated.cs
  12. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs
  13. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs
  14. +1
    -1
      src/DotNetCore.CAP/Dashboard/Pages/_SidebarMenu.generated.cs
  15. +12
    -11
      src/DotNetCore.CAP/Dashboard/RazorPage.cs
  16. +18
    -18
      src/DotNetCore.CAP/IBootstrapper.Default.cs
  17. +6
    -0
      src/DotNetCore.CAP/ICallbackPublisher.cs
  18. +1
    -1
      src/DotNetCore.CAP/IConsumerClient.cs
  19. +3
    -3
      src/DotNetCore.CAP/Internal/CapCache.cs
  20. +2
    -2
      src/DotNetCore.CAP/Internal/ConsumerContext.cs
  21. +5
    -5
      src/DotNetCore.CAP/LoggerExtensions.cs
  22. +2
    -1
      src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs

+ 1
- 1
src/DotNetCore.CAP/Dashboard/JsonStats.cs View File

@@ -37,7 +37,7 @@ namespace DotNetCore.CAP.Dashboard

private class StubPage : RazorPage
{
public override void Execute()
protected override void Execute()
{
}
}


+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/HomePage.generated.cs View File

@@ -61,7 +61,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/LayoutPage.generated.cs View File

@@ -50,7 +50,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/NodePage.generated.cs View File

@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/PublishedPage.generated.cs View File

@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/ReceivedPage.generated.cs View File

@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/SubscriberPage.generated.cs View File

@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_BlockMetric.generated.cs View File

@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_Breadcrumbs.generated.cs View File

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_InlineMetric.generated.cs View File

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_Navigation.generated.cs View File

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_Paginator.generated.cs View File

@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_PerPageSelector.generated.cs View File

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 1
- 1
src/DotNetCore.CAP/Dashboard/Pages/_SidebarMenu.generated.cs View File

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden

public override void Execute()
protected override void Execute()
{




+ 12
- 11
src/DotNetCore.CAP/Dashboard/RazorPage.cs View File

@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Net;
using System.Text;
using DotNetCore.CAP.Dashboard.Monitoring;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.NodeDiscovery;
using Microsoft.Extensions.DependencyInjection;

@@ -20,16 +21,16 @@ namespace DotNetCore.CAP.Dashboard
Html = new HtmlHelper(this);
}

public RazorPage Layout { get; protected set; }
public HtmlHelper Html { get; }
protected RazorPage Layout { get; set; }
protected HtmlHelper Html { get; }
public UrlHelper Url { get; private set; }

public IStorage Storage { get; internal set; }
public string AppPath { get; internal set; }
public string NodeName { get; internal set; }
protected IStorage Storage { get; set; }
protected string AppPath { get; set; }
protected string NodeName { get; set; }

public int StatsPollingInterval { get; internal set; }
public Stopwatch GenerationTime { get; private set; }
protected int StatsPollingInterval { get; set; }
protected Stopwatch GenerationTime { get; private set; }

public StatisticsDto Statistics
{
@@ -40,16 +41,16 @@ namespace DotNetCore.CAP.Dashboard
}
}

protected DashboardRequest Request { private get; set; }
protected DashboardResponse Response { private get; set; }
private DashboardRequest Request { get; set; }
private DashboardResponse Response { get; set; }
internal IServiceProvider RequestServices { get; private set; }

public string RequestPath => Request.Path;

/// <exclude />
public abstract void Execute();
protected abstract void Execute();

public string Query(string key)
protected string Query(string key)
{
return Request.GetQuery(key);
}


+ 18
- 18
src/DotNetCore.CAP/IBootstrapper.Default.cs View File

@@ -19,6 +19,10 @@ namespace DotNetCore.CAP
private readonly ILogger<DefaultBootstrapper> _logger;
private Task _bootstrappingTask;

private IStorage Storage { get; }

private IEnumerable<IProcessingServer> Processors { get; }

public DefaultBootstrapper(
ILogger<DefaultBootstrapper> logger,
IStorage storage,
@@ -45,10 +49,6 @@ namespace DotNetCore.CAP
});
}

protected IStorage Storage { get; }

protected IEnumerable<IProcessingServer> Processors { get; }

public Task BootstrapAsync()
{
return _bootstrappingTask = BootstrapTaskAsync();
@@ -60,10 +60,22 @@ namespace DotNetCore.CAP

if (_cts.IsCancellationRequested) return;

await BootstrapCoreAsync();
_appLifetime.ApplicationStopping.Register(() =>
{
foreach (var item in Processors)
item.Dispose();
});

if (_cts.IsCancellationRequested) return;

await BootstrapCoreAsync();

_ctsRegistration.Dispose();
_cts.Dispose();
}

protected virtual Task BootstrapCoreAsync()
{
foreach (var item in Processors)
try
{
@@ -71,20 +83,8 @@ namespace DotNetCore.CAP
}
catch (Exception ex)
{
_logger.ServerStartedError(ex);
_logger.ProcessorsStartedError(ex);
}

_ctsRegistration.Dispose();
_cts.Dispose();
}

public virtual Task BootstrapCoreAsync()
{
_appLifetime.ApplicationStopping.Register(() =>
{
foreach (var item in Processors)
item.Dispose();
});
return Task.CompletedTask;
}
}

+ 6
- 0
src/DotNetCore.CAP/ICallbackPublisher.cs View File

@@ -3,8 +3,14 @@ using DotNetCore.CAP.Models;

namespace DotNetCore.CAP
{
/// <summary>
/// A callback that is sent to Productor after a successful consumer execution
/// </summary>
public interface ICallbackPublisher
{
/// <summary>
/// Publish a callback message
/// </summary>
Task PublishAsync(CapPublishedMessage obj);
}
}

+ 1
- 1
src/DotNetCore.CAP/IConsumerClient.cs View File

@@ -6,7 +6,7 @@ namespace DotNetCore.CAP
{
/// <inheritdoc />
/// <summary>
/// consumer client
/// Message queue consumer client
/// </summary>
public interface IConsumerClient : IDisposable
{


src/DotNetCore.CAP/CapCache.cs → src/DotNetCore.CAP/Internal/CapCache.cs View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace DotNetCore.CAP
namespace DotNetCore.CAP.Internal
{
#region Cache<T> class

@@ -15,7 +15,7 @@ namespace DotNetCore.CAP
/// </summary>
// ReSharper disable once InheritdocConsiderUsage
// ReSharper disable once InconsistentNaming
public class Cache<K, T> : IDisposable
internal class Cache<K, T> : IDisposable
{
#region Constructor and class members

@@ -328,7 +328,7 @@ namespace DotNetCore.CAP
/// instance.
/// The <c>.Global</c> member is lazy instanciated.
/// </summary>
public class CapCache : Cache<string, object>
internal class CapCache : Cache<string, object>
{
#region Static Global Cache instance


+ 2
- 2
src/DotNetCore.CAP/Internal/ConsumerContext.cs View File

@@ -21,11 +21,11 @@ namespace DotNetCore.CAP.Internal
/// <summary>
/// a descriptor of consumer information need to be performed.
/// </summary>
public ConsumerExecutorDescriptor ConsumerDescriptor { get; set; }
public ConsumerExecutorDescriptor ConsumerDescriptor { get; }

/// <summary>
/// consumer received message.
/// </summary>
public MessageContext DeliverMessage { get; set; }
public MessageContext DeliverMessage { get; }
}
}

+ 5
- 5
src/DotNetCore.CAP/LoggerExtensions.cs View File

@@ -6,7 +6,7 @@ namespace DotNetCore.CAP
internal static class LoggerExtensions
{
private static readonly Action<ILogger, int, int, Exception> _serverStarting;
private static readonly Action<ILogger, Exception> _serverStartingError;
private static readonly Action<ILogger, Exception> _processorsStartingError;
private static readonly Action<ILogger, Exception> _serverShuttingDown;
private static readonly Action<ILogger, string, Exception> _expectedOperationCanceledException;

@@ -31,10 +31,10 @@ namespace DotNetCore.CAP
1,
"Starting the processing server. Detected {MachineProcessorCount} machine processor(s). Initiating {ProcessorCount} job processor(s).");

_serverStartingError = LoggerMessage.Define(
_processorsStartingError = LoggerMessage.Define(
LogLevel.Error,
5,
"Starting the processing server throw an exception.");
"Starting the processors throw an exception.");

_serverShuttingDown = LoggerMessage.Define(
LogLevel.Debug,
@@ -149,9 +149,9 @@ namespace DotNetCore.CAP
_serverStarting(logger, machineProcessorCount, processorCount, null);
}

public static void ServerStartedError(this ILogger logger, Exception ex)
public static void ProcessorsStartedError(this ILogger logger, Exception ex)
{
_serverStartingError(logger, ex);
_processorsStartingError(logger, ex);
}

public static void ServerShuttingDown(this ILogger logger)


+ 2
- 1
src/DotNetCore.CAP/NodeDiscovery/INodeDiscoveryProvider.Consul.cs View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Consul;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.Logging;

namespace DotNetCore.CAP.NodeDiscovery
@@ -90,7 +91,7 @@ namespace DotNetCore.CAP.NodeDiscovery
}
}

public void InitClient()
private void InitClient()
{
_consul = new ConsulClient(config =>
{


Loading…
Cancel
Save