2017-01-31 11:01:08 +00:00
|
|
|
|
using System;
|
2018-12-19 19:50:56 +00:00
|
|
|
|
|
2016-12-11 14:08:58 +00:00
|
|
|
|
namespace Tapeti.Config
|
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides information about the message currently being handled.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
public interface IMessageContext : IDisposable
|
2016-12-11 14:08:58 +00:00
|
|
|
|
{
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides access to the Tapeti config.
|
|
|
|
|
/// </summary>
|
|
|
|
|
ITapetiConfig Config { get; }
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the name of the queue the message was consumed from.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
string Queue { get; }
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the exchange to which the message was published.
|
|
|
|
|
/// </summary>
|
|
|
|
|
string Exchange { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the routing key as provided when the message was published.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
string RoutingKey { get; }
|
2019-08-13 18:30:04 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Contains the decoded message instance.
|
|
|
|
|
/// </summary>
|
2016-12-11 14:08:58 +00:00
|
|
|
|
object Message { get; }
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides access to the message metadata.
|
|
|
|
|
/// </summary>
|
|
|
|
|
IMessageProperties Properties { get; }
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2017-02-15 21:05:01 +00:00
|
|
|
|
/// <remarks>
|
2019-08-13 18:30:04 +00:00
|
|
|
|
/// Provides access to the binding which is currently processing the message.
|
2017-02-15 21:05:01 +00:00
|
|
|
|
/// </remarks>
|
2017-02-05 22:22:34 +00:00
|
|
|
|
IBinding Binding { get; }
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stores a key-value pair in the context for passing information between the various
|
|
|
|
|
/// middleware stages (mostly for IControllerMiddlewareBase descendants).
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key">A unique key. It is recommended to prefix it with the package name which hosts the middleware to prevent conflicts</param>
|
|
|
|
|
/// <param name="value">Will be disposed if the value implements IDisposable</param>
|
|
|
|
|
void Store(string key, object value);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves a previously stored value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="key"></param>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
/// <returns>True if the value was found, False otherwise</returns>
|
|
|
|
|
bool Get<T>(string key, out T value) where T : class;
|
2016-12-11 14:08:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|