Commit c1b1509e authored by yangxiaodong's avatar yangxiaodong

refactor

parent 7e84a153
...@@ -5,7 +5,10 @@ using System.Linq; ...@@ -5,7 +5,10 @@ using System.Linq;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic; using System.Collections.Generic;
using Cap.Consistency.Consumer; using Cap.Consistency.Consumer;
using Cap.Consistency.Consumer.Kafka; using Cap.Consistency.Routing;
using Cap.Consistency.Infrastructure;
using Cap.Consistency.Internal;
using Cap.Consistency.Abstractions;
namespace Cap.Consistency namespace Cap.Consistency
{ {
...@@ -24,6 +27,8 @@ namespace Cap.Consistency ...@@ -24,6 +27,8 @@ namespace Cap.Consistency
Services = service; Services = service;
AddConsumerServices(); AddConsumerServices();
AddKafkaServices();
} }
/// <summary> /// <summary>
...@@ -60,14 +65,17 @@ namespace Cap.Consistency ...@@ -60,14 +65,17 @@ namespace Cap.Consistency
Services.AddSingleton(typeof(IConsumerService), type); Services.AddSingleton(typeof(IConsumerService), type);
} }
} }
Services.AddSingleton<IConsumerExcutorSelector, ConsumerExcutorSelector>();
Services.AddSingleton<IConsumerInvokerFactory, ConsumerInvokerFactory>();
Services.AddSingleton<MethodMatcherCache>();
return this; return this;
} }
public virtual ConsistencyBuilder AddKafkaServices() { public virtual ConsistencyBuilder AddKafkaServices() {
return AddScoped(typeof(ITopicRoute), typeof(ConsumerHandler<>).MakeGenericType(MessageType));
Services.AddSingleton<IConsumerHandler, KafkaConsumerHandler>();
return this;
} }
......
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