/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/RedeliverExtensions.cs
31 строка
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 { using System; using System.Threading.Tasks; using Context; public static class RedeliverExtensions { /// <summary> /// Redeliver uses the message scheduler to deliver the message to the queue at a future /// time. The delivery count is incremented. Moreover, if you give custom callback action, it perform before sending message to queue. /// A message scheduler must be configured on the bus for redelivery to be enabled. /// </summary> /// <typeparam name="T">The message type</typeparam> /// <param name="context">The consume context of the message</param> /// <param name="delay"> /// The delay before the message is delivered. It may take longer to receive the message if the queue is not empty. /// </param> /// <param name="callback">Operation which is executed before the message is delivered.</param> /// <returns></returns> public static Task Redeliver<T>(this ConsumeContext<T> context, TimeSpan delay, Action<ConsumeContext, SendContext> callback = null) where T : class { if (!context.TryGetPayload(out MessageRedeliveryContext redeliveryContext)) redeliveryContext = new ScheduleMessageRedeliveryContext<T>(context, RedeliveryOptions.ReplaceMessageId); return redeliveryContext.ScheduleRedelivery(delay, callback); } } }