/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit.Abstractions/Middleware/AgentExtensions.cs
51 строка
2 KB
Chris Patterson
Adding nullability to abstractions, and fixing warnings
15 фев 2022, 17:36
15 фев 2022, 17:36
8a72e94
Код
Авторство
О чём код?
namespace MassTransit { using System.Threading; using System.Threading.Tasks; using Middleware; public static class AgentExtensions { /// <summary> /// Stop the agent, using the default StopContext /// </summary> /// <param name="agent"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public static Task Stop(this IAgent agent, CancellationToken cancellationToken = default) { var stopContext = new DefaultStopContext(cancellationToken); return agent.Stop(stopContext); } /// <summary> /// Stop the agent, using the default StopContext /// </summary> /// <param name="agent"></param> /// <param name="reason">The reason for stopping the agent</param> /// <param name="cancellationToken"></param> /// <returns></returns> public static Task Stop(this IAgent agent, string reason, CancellationToken cancellationToken = default) { var stopContext = new DefaultStopContext(cancellationToken) { Reason = reason }; return agent.Stop(stopContext); } class DefaultStopContext : BasePipeContext, StopContext { public DefaultStopContext(CancellationToken cancellationToken) : base(cancellationToken) { Reason = "Stopped"; } public string Reason { get; set; } } } }