diff --git a/src/Cap.Consistency/Consumer/ConsumerHandler.cs b/src/Cap.Consistency/Consumer/ConsumerHandler.cs index 15c778c..5f2f650 100644 --- a/src/Cap.Consistency/Consumer/ConsumerHandler.cs +++ b/src/Cap.Consistency/Consumer/ConsumerHandler.cs @@ -4,14 +4,14 @@ using System.Linq; using System.Threading.Tasks; using Cap.Consistency.Abstractions; using Cap.Consistency.Infrastructure; -using Cap.Consistency.Routing; using Cap.Consistency.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Cap.Consistency.Store; namespace Cap.Consistency.Consumer { - public class ConsumerHandler : IConsumerHandler where T : ConsistencyMessage, new() + public class ConsumerHandler : IConsumerHandler { private readonly IServiceProvider _serviceProvider; private readonly IConsumerInvokerFactory _consumerInvokerFactory; @@ -20,21 +20,21 @@ namespace Cap.Consistency.Consumer private readonly ILogger _logger; private readonly MethodMatcherCache _selector; private readonly ConsistencyOptions _options; - private readonly ConsistencyMessageManager _messageManager; + private readonly ConsistencyMessageManager _messageManager; - public event EventHandler MessageReceieved; + public event EventHandler MessageReceieved; public ConsumerHandler( IServiceProvider serviceProvider, IConsumerInvokerFactory consumerInvokerFactory, IConsumerClientFactory consumerClientFactory, ILoggerFactory loggerFactory, - ConsistencyMessageManager messageManager, + ConsistencyMessageManager messageManager, MethodMatcherCache selector, IOptions options) { _selector = selector; - _logger = loggerFactory.CreateLogger>(); + _logger = loggerFactory.CreateLogger(); _loggerFactory = loggerFactory; _serviceProvider = serviceProvider; _consumerInvokerFactory = consumerInvokerFactory; @@ -44,7 +44,7 @@ namespace Cap.Consistency.Consumer } - protected virtual void OnMessageReceieved(T message) { + protected virtual void OnMessageReceieved(ConsistencyMessage message) { MessageReceieved?.Invoke(this, message); } @@ -77,7 +77,7 @@ namespace Cap.Consistency.Consumer } private void OnMessageReceieved(object sender, DeliverMessage message) { - T consistencyMessage = new T() { + var consistencyMessage = new ConsistencyMessage() { Id = message.MessageKey, Payload = Encoding.UTF8.GetString(message.Body) }; diff --git a/src/Cap.Consistency/Consumer/IConsumerHandler.cs b/src/Cap.Consistency/Consumer/IConsumerHandler.cs index e216136..21a1aa2 100644 --- a/src/Cap.Consistency/Consumer/IConsumerHandler.cs +++ b/src/Cap.Consistency/Consumer/IConsumerHandler.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using System.Text; using Cap.Consistency.Infrastructure; -using Cap.Consistency.Routing; namespace Cap.Consistency.Consumer { - public interface IConsumerHandler : ITopicRoute where T : ConsistencyMessage, new() + public interface IConsumerHandler: ITopicRouteHandler { }