Browse Source

Add summary comment.

master
yangxiaodong 7 years ago
parent
commit
34f77642f2
4 changed files with 35 additions and 6 deletions
  1. +1
    -1
      samples/Sample.Kafka/Startup.cs
  2. +3
    -3
      src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs
  3. +22
    -2
      src/DotNetCore.CAP/CAP.Builder.cs
  4. +9
    -0
      src/DotNetCore.CAP/CAP.Options.cs

+ 1
- 1
samples/Sample.Kafka/Startup.cs View File

@@ -38,7 +38,7 @@ namespace Sample.Kafka

app.UseMvc();

app.UseConsistency();
app.UseCap();
}
}
}

+ 3
- 3
src/DotNetCore.CAP/CAP.AppBuilderExtensions.cs View 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)
{


+ 22
- 2
src/DotNetCore.CAP/CAP.Builder.cs View File

@@ -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
{


+ 9
- 0
src/DotNetCore.CAP/CAP.Options.cs View File

@@ -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;
}
}

Loading…
Cancel
Save