2019-08-15 14:00:04 +00:00
|
|
|
|
using System.Reflection;
|
2019-08-15 10:04:03 +00:00
|
|
|
|
using Tapeti.Config;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Flow.Default
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default implementation for IFlowHandlerContext
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class FlowHandlerContext : IFlowHandlerContext
|
|
|
|
|
{
|
2021-05-29 19:51:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
2019-08-15 10:04:03 +00:00
|
|
|
|
public FlowHandlerContext()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-29 19:51:58 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
2021-09-02 14:16:11 +00:00
|
|
|
|
public FlowHandlerContext(IMessageContext source)
|
2019-08-15 10:04:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (source == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-09-02 14:16:11 +00:00
|
|
|
|
if (!source.TryGet<ControllerMessageContextPayload>(out var controllerPayload))
|
|
|
|
|
return;
|
|
|
|
|
|
2019-08-15 10:04:03 +00:00
|
|
|
|
Config = source.Config;
|
2021-09-02 14:16:11 +00:00
|
|
|
|
Controller = controllerPayload.Controller;
|
|
|
|
|
Method = controllerPayload.Binding.Method;
|
|
|
|
|
MessageContext = source;
|
2019-08-15 10:04:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ITapetiConfig Config { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public object Controller { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public MethodInfo Method { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2021-09-02 14:16:11 +00:00
|
|
|
|
public IMessageContext MessageContext { get; set; }
|
2019-08-15 10:04:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|