2021-06-02 18:56:10 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Tapeti.Config;
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
|
|
|
|
namespace Tapeti.Default
|
|
|
|
|
{
|
2019-08-15 09:26:55 +00:00
|
|
|
|
internal class ControllerMessageContext : IControllerMessageContext
|
2019-08-13 18:30:04 +00:00
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
private readonly IMessageContext decoratedContext;
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public object Controller { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2019-08-14 18:48:40 +00:00
|
|
|
|
public ITapetiConfig Config => decoratedContext.Config;
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public string Queue => decoratedContext.Queue;
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2019-08-14 18:48:40 +00:00
|
|
|
|
public string Exchange => decoratedContext.Exchange;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public string RoutingKey => decoratedContext.RoutingKey;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public object Message => decoratedContext.Message;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public IMessageProperties Properties => decoratedContext.Properties;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IBinding IMessageContext.Binding => decoratedContext.Binding;
|
|
|
|
|
IControllerMethodBinding IControllerMessageContext.Binding => decoratedContext.Binding as IControllerMethodBinding;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ControllerMessageContext(IMessageContext decoratedContext)
|
2019-08-13 18:30:04 +00:00
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
this.decoratedContext = decoratedContext;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2021-06-02 18:56:10 +00:00
|
|
|
|
// Do not call decoratedContext.Dispose - by design
|
2019-08-13 18:30:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-06-02 18:56:10 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ValueTask DisposeAsync()
|
|
|
|
|
{
|
|
|
|
|
// Do not call decoratedContext.DisposeAsync - by design
|
|
|
|
|
return default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Store(string key, object value)
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
decoratedContext.Store(key, value);
|
2019-08-13 18:30:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public bool Get<T>(string key, out T value) where T : class
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
return decoratedContext.Get(key, out value);
|
2019-08-13 18:30:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|