/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Consumers/Consumer/ObjectConsumerFactory.cs
29 строк
868 B
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.Consumer { using System; using System.Threading.Tasks; public class ObjectConsumerFactory<TConsumer> : IConsumerFactory<TConsumer> where TConsumer : class { readonly IConsumerFactory<TConsumer> _delegate; public ObjectConsumerFactory(Func<Type, object> objectFactory) { _delegate = new DelegateConsumerFactory<TConsumer>(() => (TConsumer)objectFactory(typeof(TConsumer))); } public Task Send<TMessage>(ConsumeContext<TMessage> context, IPipe<ConsumerConsumeContext<TConsumer, TMessage>> next) where TMessage : class { return _delegate.Send(context, next); } void IProbeSite.Probe(ProbeContext context) { context.CreateConsumerFactoryScope<TConsumer>("objectFactory"); } } }