Commit 34f77642 authored by yangxiaodong's avatar yangxiaodong

Add summary comment.

parent 05125fc6
...@@ -38,7 +38,7 @@ namespace Sample.Kafka ...@@ -38,7 +38,7 @@ namespace Sample.Kafka
app.UseMvc(); app.UseMvc();
app.UseConsistency(); app.UseCap();
} }
} }
} }
\ No newline at end of file
...@@ -5,16 +5,16 @@ using Microsoft.Extensions.DependencyInjection; ...@@ -5,16 +5,16 @@ using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder namespace Microsoft.AspNetCore.Builder
{ {
/// <summary> /// <summary>
/// Consistence extensions for <see cref="IApplicationBuilder"/> /// app extensions for <see cref="IApplicationBuilder"/>
/// </summary> /// </summary>
public static class AppBuilderExtensions public static class AppBuilderExtensions
{ {
///<summary> ///<summary>
/// Enables Consistence for the current application /// Enables cap for the current application
/// </summary> /// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> instance this method extends.</param> /// <param name="app">The <see cref="IApplicationBuilder"/> instance this method extends.</param>
/// <returns>The <see cref="IApplicationBuilder"/> instance this method extends.</returns> /// <returns>The <see cref="IApplicationBuilder"/> instance this method extends.</returns>
public static IApplicationBuilder UseConsistency(this IApplicationBuilder app) public static IApplicationBuilder UseCap(this IApplicationBuilder app)
{ {
if (app == null) if (app == null)
{ {
......
...@@ -5,10 +5,13 @@ using DotNetCore.CAP.Job; ...@@ -5,10 +5,13 @@ using DotNetCore.CAP.Job;
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
/// <summary> /// <summary>
/// Used to verify Consistency service was called on a ServiceCollection /// Used to verify cap service was called on a ServiceCollection
/// </summary> /// </summary>
public class CapMarkerService { } public class CapMarkerService { }
/// <summary>
/// Allows fine grained configuration of CAP services.
/// </summary>
public class CapBuilder public class CapBuilder
{ {
public CapBuilder(IServiceCollection services) public CapBuilder(IServiceCollection services)
...@@ -16,14 +19,23 @@ namespace Microsoft.Extensions.DependencyInjection ...@@ -16,14 +19,23 @@ namespace Microsoft.Extensions.DependencyInjection
Services = services; Services = services;
} }
/// <summary>
/// Gets the <see cref="IServiceCollection"/> where MVC services are configured.
/// </summary>
public IServiceCollection Services { get; private set; } public IServiceCollection Services { get; private set; }
/// <summary>
/// Adds a scoped service of the type specified in serviceType with an implementation
/// </summary>
private CapBuilder AddScoped(Type serviceType, Type concreteType) private CapBuilder AddScoped(Type serviceType, Type concreteType)
{ {
Services.AddScoped(serviceType, concreteType); Services.AddScoped(serviceType, concreteType);
return this; return this;
} }
/// <summary>
/// Adds a singleton service of the type specified in serviceType with an implementation
/// </summary>
private CapBuilder AddSingleton<TService, TImplementation>() private CapBuilder AddSingleton<TService, TImplementation>()
where TService : class where TService : class
where TImplementation : class, TService where TImplementation : class, TService
...@@ -33,7 +45,7 @@ namespace Microsoft.Extensions.DependencyInjection ...@@ -33,7 +45,7 @@ namespace Microsoft.Extensions.DependencyInjection
} }
/// <summary> /// <summary>
/// Adds an <see cref="ICapMessageStore"/> . /// Add an <see cref="ICapMessageStore"/> .
/// </summary> /// </summary>
/// <typeparam name="T">The type for the <see cref="ICapMessageStore"/> to add. </typeparam> /// <typeparam name="T">The type for the <see cref="ICapMessageStore"/> to add. </typeparam>
/// <returns>The current <see cref="CapBuilder"/> instance.</returns> /// <returns>The current <see cref="CapBuilder"/> instance.</returns>
...@@ -43,12 +55,20 @@ namespace Microsoft.Extensions.DependencyInjection ...@@ -43,12 +55,20 @@ namespace Microsoft.Extensions.DependencyInjection
return AddScoped(typeof(ICapMessageStore), typeof(T)); return AddScoped(typeof(ICapMessageStore), typeof(T));
} }
/// <summary>
/// Add an <see cref="IJob"/> for process <see cref="CapJob"/>.
/// </summary>
/// <typeparam name="T">The type of the job.</typeparam>
public virtual CapBuilder AddJobs<T>() public virtual CapBuilder AddJobs<T>()
where T : class, IJob where T : class, IJob
{ {
return AddSingleton<IJob, T>(); return AddSingleton<IJob, T>();
} }
/// <summary>
/// Add an <see cref="ICapProducerService"/>.
/// </summary>
/// <typeparam name="T">The type of the service.</typeparam>
public virtual CapBuilder AddProducerService<T>() public virtual CapBuilder AddProducerService<T>()
where T : class, ICapProducerService where T : class, ICapProducerService
{ {
......
...@@ -7,10 +7,19 @@ namespace DotNetCore.CAP.Infrastructure ...@@ -7,10 +7,19 @@ namespace DotNetCore.CAP.Infrastructure
/// </summary> /// </summary>
public class CapOptions public class CapOptions
{ {
/// <summary>
/// kafka or rabbitMQ brokers connection string.
/// </summary>
public string BrokerUrlList { get; set; } = "localhost:9092"; public string BrokerUrlList { get; set; } = "localhost:9092";
/// <summary>
/// Corn expression for configuring retry cron job. Default is 1 min.
/// </summary>
public string CronExp { get; set; } = Cron.Minutely(); public string CronExp { get; set; } = Cron.Minutely();
/// <summary>
/// Productor job polling delay time. Default is 8 sec.
/// </summary>
public int PollingDelay { get; set; } = 8; public int PollingDelay { get; set; } = 8;
} }
} }
\ No newline at end of file
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