diff --git a/src/Cap.Consistency/Extensions/BuilderExtensions.cs b/src/Cap.Consistency/Extensions/BuilderExtensions.cs
index 03f9abc..76fe38d 100644
--- a/src/Cap.Consistency/Extensions/BuilderExtensions.cs
+++ b/src/Cap.Consistency/Extensions/BuilderExtensions.cs
@@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Builder
///
public static class BuilderExtensions
{
- ///
+ ///
/// Enables Consistence for the current application
///
/// The instance this method extends.
@@ -20,34 +20,20 @@ namespace Microsoft.AspNetCore.Builder
if (app == null) {
throw new ArgumentNullException(nameof(app));
}
-
+
var marker = app.ApplicationServices.GetService();
+
if (marker == null) {
throw new InvalidOperationException("Add Consistency must be called on the service collection.");
}
- return app;
- }
-
- public static IApplicationBuilder UserRouter(this IApplicationBuilder builder, ITopicRoute router) {
- if (builder == null) {
- throw new ArgumentNullException(nameof(builder));
- }
-
- if (router == null) {
- throw new ArgumentNullException(nameof(router));
- }
-
- var marker = builder.ApplicationServices.GetService();
- if (marker == null) {
- throw new InvalidOperationException("Add Consistency must be called on the service collection.");
- }
+ var router = app.ApplicationServices.GetService();
var context = new TopicRouteContext();
router.RouteAsync(context).Wait();
- return builder;
+ return app;
}
}
diff --git a/src/Cap.Consistency/Extensions/ConsistencyOptions.cs b/src/Cap.Consistency/Extensions/ConsistencyOptions.cs
index c2863d1..53e21c9 100644
--- a/src/Cap.Consistency/Extensions/ConsistencyOptions.cs
+++ b/src/Cap.Consistency/Extensions/ConsistencyOptions.cs
@@ -7,14 +7,6 @@ namespace Microsoft.AspNetCore.Builder
///
public class ConsistencyOptions
{
- ///
- /// Gets or sets the for the consistency system.
- ///
- public BrokerOptions Broker { get; set; } = new BrokerOptions();
-
-
- public string BrokerUrlList { get; set; }
-
-
+ public string BrokerUrlList { get; set; } = "localhost:9092";
}
}
\ No newline at end of file
diff --git a/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs b/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs
index 89f22c6..f4d1402 100644
--- a/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs
+++ b/src/Cap.Consistency/Extensions/ServiceCollectionExtensions.cs
@@ -1,5 +1,6 @@
using System;
using Cap.Consistency;
+using Cap.Consistency.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -17,7 +18,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// The services available in the application.
/// An for application services.
public static ConsistencyBuilder AddConsistency(this IServiceCollection services)
- where TMessage : class {
+ where TMessage : ConsistencyMessage {
return services.AddConsistency(setupAction: null);
}
@@ -28,13 +29,11 @@ namespace Microsoft.Extensions.DependencyInjection
/// An action to configure the .
/// An for application services.
public static ConsistencyBuilder AddConsistency(this IServiceCollection services, Action setupAction)
- where TMessage : class {
+ where TMessage : ConsistencyMessage {
services.TryAddSingleton();
services.TryAddScoped, ConsistencyMessageManager>();
- services.AddSingleton();
-
if (setupAction != null) {
services.Configure(setupAction);
}