/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Consumers/Configuration/HandlerPipeSpecification.cs
33 строки
933 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.Configuration { using System.Collections.Generic; using Middleware; /// <summary> /// Adds a message handler to the consuming pipe builder /// </summary> /// <typeparam name="T">The message type</typeparam> public class HandlerPipeSpecification<T> : IPipeSpecification<ConsumeContext<T>> where T : class { readonly MessageHandler<T> _handler; public HandlerPipeSpecification(MessageHandler<T> handler) { _handler = handler; } void IPipeSpecification<ConsumeContext<T>>.Apply(IPipeBuilder<ConsumeContext<T>> builder) { builder.AddFilter(new HandlerMessageFilter<T>(_handler)); } IEnumerable<ValidationResult> ISpecification.Validate() { if (_handler == null) yield return this.Failure("Handler", "must not be null"); } } }