/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Consumers/Consumer/InstanceConsumerFactory.cs
34 строки
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.Consumer { using System.Threading.Tasks; using Context; /// <summary> /// Retains a reference to an existing message consumer, and uses it to send consumable messages for /// processing. /// </summary> /// <typeparam name="TConsumer">The consumer type</typeparam> public class InstanceConsumerFactory<TConsumer> : IConsumerFactory<TConsumer> where TConsumer : class { readonly TConsumer _consumer; public InstanceConsumerFactory(TConsumer consumer) { _consumer = consumer; } public Task Send<TMessage>(ConsumeContext<TMessage> context, IPipe<ConsumerConsumeContext<TConsumer, TMessage>> next) where TMessage : class { return next.Send(new ConsumerConsumeContextScope<TConsumer, TMessage>(context, _consumer)); } void IProbeSite.Probe(ProbeContext context) { context.CreateConsumerFactoryScope<TConsumer>("instance"); } } }