I’m trying to create an Automatic Procces Flow using Hangfire. This flow is started with one RecurringJob that starts in turn 4 BackgroundJobs (SubProcesses):
string collectId = BackgroundJob.ContinueJobWith<CollectProcess>(context.BackgroundJob.Id, (cp) => cp.Execute(context, null), JobContinuationOptions.OnlyOnSucceededState);
context.CancellationToken.ThrowIfCancellationRequested();
string checksId = BackgroundJob.ContinueJobWith<ChecksProcess>(collectId, (cp) => cp.Execute(context, null), JobContinuationOptions.OnlyOnSucceededState);
context.CancellationToken.ThrowIfCancellationRequested();
string logicId = BackgroundJob.ContinueJobWith<LogicProcess>(checksId, (cp) => cp.Execute(context, null), JobContinuationOptions.OnlyOnSucceededState);
context.CancellationToken.ThrowIfCancellationRequested();
string saveId = BackgroundJob.ContinueJobWith<SaveProcess>(logicId, (cp) => cp.Execute(context, null), JobContinuationOptions.OnlyOnSucceededState);
context.CancellationToken.ThrowIfCancellationRequested();
But inside the BackgroundJobs I can’t access the same State that the Previous job altered.
Should this be possible with Hangfire? Am I missing something?
Kind regards,
Henry