在MassTransit中,如果我计划将来发送一条消息(比方说3天之内),并且我将消息的TTL设置为1天,那么该消息的实际TTL是否为4天?>
如果我将消息安排在将来的30天,则倾向于将TTL设置为30 + 1天,但是我不想这样做,以防我又不知道又增加了30天的TTL的.
解决方案从查看 MassTransit存储库,似乎TTL应用于消息发送,而不是消息创建时:
if(context.TimeToLive.HasValue)transportMessage.NMSTimeToLive = context.TimeToLive>TimeSpan.Zero?context.TimeToLive.Value:TimeSpan.FromSeconds(1);...var publishTask = Task.Run(()=> producer.Send(transportMessage),context.CancellationToken);因此,您应该将发布时间设置为1天,直到发送邮件之前不考虑TTL.
In MassTransit, if I schedule a message to be delivered in the future (let's say in 3 days), and I set a TTL on the message for 1 day, is the actual TTL for the message then 4 days?
If I schedule a message 30 days in the future, I'm tempted to set the TTL to 30 + 1 days, but I don't want to do that in case that adds another 30 days of TTL that I am unaware of.
解决方案From looking at the MassTransit repository, it seems like the TTL is applied upon the message being sent, rather than when it was created:
if (context.TimeToLive.HasValue) transportMessage.NMSTimeToLive = context.TimeToLive > TimeSpan.Zero ? context.TimeToLive.Value : TimeSpan.FromSeconds(1); ... var publishTask = Task.Run(() => producer.Send(transportMessage), context.CancellationToken);So should you set your publish time to be 1 day, until the message is sent the TTL is not considered.
更多推荐
在MassTransit中,如果我为预定消息设置了TTL,是否包括初始延迟?
发布评论