Commit 34f77642 authored by yangxiaodong's avatar yangxiaodong

Add summary comment.

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