Commit 8a56c35a authored by Savorboard's avatar Savorboard

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

parents ae671216 6cdfc50c
......@@ -37,7 +37,7 @@ namespace DotNetCore.CAP.Dashboard
private class StubPage : RazorPage
{
public override void Execute()
protected override void Execute()
{
}
}
......
......@@ -61,7 +61,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -50,7 +50,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -45,7 +45,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -33,7 +33,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Dashboard.Pages
{
#line hidden
public override void Execute()
protected override void Execute()
{
......
......@@ -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);
}
......
......@@ -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;
}
}
......
......@@ -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);
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ namespace DotNetCore.CAP
{
/// <inheritdoc />
/// <summary>
/// consumer client
/// Message queue consumer client
/// </summary>
public interface IConsumerClient : IDisposable
{
......
......@@ -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
......
......@@ -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; }
}
}
\ No newline at end of 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)
......
......@@ -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 =>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment