2021-09-02 16:16:11 +02:00
|
|
|
|
using System;
|
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
using Tapeti.Flow.Default;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Flow
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains information about the flow for the current message. For internal use.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class FlowMessageContextPayload : IMessageContextPayload, IDisposable
|
|
|
|
|
{
|
|
|
|
|
public FlowContext FlowContext { get; }
|
2021-12-10 09:56:37 +01:00
|
|
|
|
|
2021-09-02 16:16:11 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates if the current message handler is the last one to be called before a
|
|
|
|
|
/// parallel flow is done and the convergeMethod will be called.
|
|
|
|
|
/// Temporarily disables storing the flow state.
|
|
|
|
|
/// </summary>
|
2022-11-23 09:13:38 +01:00
|
|
|
|
public bool FlowIsConverging => FlowContext.FlowState.Continuations.Count == 0 &&
|
|
|
|
|
FlowContext.ContinuationMetadata?.ConvergeMethodName != null;
|
2021-09-02 16:16:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FlowMessageContextPayload(FlowContext flowContext)
|
|
|
|
|
{
|
|
|
|
|
FlowContext = flowContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2022-11-23 09:13:38 +01:00
|
|
|
|
FlowContext.Dispose();
|
2021-09-02 16:16:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|