Created
May 28, 2020 17:38
-
-
Save bforrest/8ba00354022da1d7d4253ee0e54d5c09 to your computer and use it in GitHub Desktop.
Masstransit-schedule-timeout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var configuredDelay = TimeSpan.FromMinutes(30); | |
Schedule( () => ActivityCompletionTimeout, | |
instance => instance.ActivityCompletionTimeoutTokenId, | |
s => | |
{ | |
s.Delay = configuredDelay; | |
s.Received = r => r.CorrelateById(context => context.Message.SagaId); | |
}); | |
During(Initial, | |
When(Start) | |
.Activity(x => x.OfType<Activity>()) | |
.TransitionTo(NextState) | |
.Execute( context => new PublishNextCommand(howMany)) | |
.Schedule(ActivityCompletionTimeout, | |
ctx => ctx.Init<ActivityCompletionTimeoutExpired>( | |
new { | |
SagaId = ctx.Instance.CorrelationId, | |
ctx.Instance.CorrelationId, | |
CommandName = nameof(PublishNextCommand) | |
} | |
) | |
, ctx => configuredDelay)); // Thought this would set the timeout for the ActivityCompletionTimeout to 30 minutes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment