/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Consumers/Configuration/BatchMessageConnectorFactory.cs
30 строк
1 KB
Chris Patterson
Integration of all external packages into MassTransit, split out into Abstractions, Middleware, and the core MassTransit assembly.
22 янв 2022, 18:24
22 янв 2022, 18:24
b5b4f50
Код
Авторство
О чём код?
namespace MassTransit.Configuration { using System; public class BatchMessageConnectorFactory<TConsumer, TMessage> : IMessageConnectorFactory where TConsumer : class, IConsumer<Batch<TMessage>> where TMessage : class { readonly BatchConsumerMessageConnector<TConsumer, TMessage> _consumerConnector; public BatchMessageConnectorFactory() { _consumerConnector = new BatchConsumerMessageConnector<TConsumer, TMessage>(); } public IConsumerMessageConnector<T> CreateConsumerConnector<T>() where T : class { return _consumerConnector as IConsumerMessageConnector<T> ?? throw new ArgumentException("The consumer type did not match the connector type"); } public IInstanceMessageConnector<T> CreateInstanceConnector<T>() where T : class { throw new NotSupportedException($"Batch<{TypeCache<TMessage>.ShortName}> cannot be connected to a consumer instance."); } } }