Commit 548e3ec0 authored by yangxiaodong's avatar yangxiaodong

refactor

parent c04f65c8
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Cap.Consistency.Consumer;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
namespace Cap.Consistency
{
public class KafkaConsistency : IRoute
{
private IServiceProvider _serviceProvider;
private IEnumerable<IConsumerHandler> _handlers;
public KafkaConsistency(IServiceProvider serviceProvider) {
_serviceProvider = serviceProvider;
}
public void Start() {
_handlers = _serviceProvider.GetServices<IConsumerHandler>();
var services = _serviceProvider.GetServices<IConsumerService>();
foreach (var handler in _handlers) {
handler.Start(services);
}
}
public void Stop() {
foreach (var handler in _handlers) {
handler.Stop();
}
}
public async Task Start() {
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Cap.Consistency.Models
{
public interface IConsumerModel
{
string TopicName { get; set; }
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using Cap.Consistency.Abstractions;
namespace Cap.Consistency
{
public class RouteTable : IReadOnlyList<ConsumerExecutorDescriptor>
{
public RouteTable() {
}
public RouteTable(List<ConsumerExecutorDescriptor> messageMethods) {
QMessageMethods = messageMethods;
}
public ConsumerExecutorDescriptor this[int index] {
get {
throw new NotImplementedException();
}
}
public int Count {
get {
throw new NotImplementedException();
}
}
public List<ConsumerExecutorDescriptor> QMessageMethods { get; set; }
public IEnumerator<ConsumerExecutorDescriptor> GetEnumerator() {
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator() {
throw new NotImplementedException();
}
}
}
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